INNER CODE UNIT · Python

new_file

changyeyu/LLM-RL-Visualized · src/rename_images.py:105

                        new_file = new_prefix + ext
                        old_path = os.path.join(root, file)
                        new_path = os.path.join(root, new_file)
                        try:
                            os.rename(old_path, new_path)
                            print(f"[{desc}] Renamed: {old_path} -> {new_path}")
                        except Exception as e:
                            print(f"Error renaming {old_path}: {e}")
                    else:
                        print(f"Number {n} exceeds the number of rows in the Excel file {excel_path} (file: {file}).")
                else:
                    # If the file name does not match the pattern "幻灯片n", skip it
                    continue

def main():
    parser = argparse.ArgumentParser(
        description="Execute one of two functions based on command line parameter: add column to Excel or rename image files."
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…