python 批量移动文件
import os
import shutil
import pandas as pd
picture_path = r"C:\WorkStation\mengla\音响\马来西亚音响\picture"
path = r"C:\WorkStation\mengla\音响\马来西亚音响\马来西亚brand.xlsx"
df = pd.read_excel(path)
other_speakers = df.loc[df["category"].isin(["其他"])]
other_speakers = other_speakers["item_id"].values.tolist()
other_speakers = [str(other_speaker) + ".png" for other_speaker in other_speakers]
print(other_speakers)
for other_speaker in other_speakers:
try:
shutil.copy(r"C:\WorkStation\mengla\音响\马来西亚音响\picture"+"\"+other_speaker, "./其他")
except Exception as e:
print(e)
print(other_speaker)
continue
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)