python 批量移动文件

python 批量移动文件,第1张

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

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/568623.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-09
下一篇 2022-04-09

发表评论

登录后才能评论

评论列表(0条)

保存