import shutil
if __name__ == '__main__':
file_object = open('/home/jiao/Pictures/image/zz.txt', 'rU')
try:
for line in file_object:
# print(line)
shutil.move('/home/jiao/Pictures/image/'+line.rstrip('\n')+'.jpg', "/home/jiao/Pictures/zz")
# shutil.copy(finame1_path, filename_path) move是移动文件,copy是复制文件(速度比较慢)
finally:
file_object.close()
python中移动文件
最新推荐文章于 2024-01-18 14:46:48 发布