INNER CODE UNIT · Python
rename_images
changyeyu/LLM-RL-Visualized · src/rename_images.py:39
def rename_images():
"""
Function 2: Rename image files.
For the directory "images_chinese" and all its subdirectories:
- Use the third column of the Excel file "src/conf/info-ch.xlsx" to rename image files.
- Files starting with "幻灯片n" (n starting from 1) will be renamed where the new
prefix is the nth entry of the Excel file's third column, while preserving the original
file extension.
Similarly, for the "images_english" directory, use "src/conf/info-en.xlsx" for renaming.
"""
# Mapping for Chinese and English directories and Excel files
config = [
{
"img_dir": "images_chinese",
"excel_file": "src/conf/info-ch.xlsx",
"desc": "Chinese"
},
{