import os
list_all = []
temp=input('请输入您要导出的盘符:')
ii=str(temp)
for root, dirs, files in os.walk(ii):
for name in files:
file_path = os.path.join(root, name)
print(os.path.split(file_path))
# file_name = os.path.join(file_path)
list_all.append(file_path)
print('\n'.join(list_all))
c = str('\n'.join(list_all))
f = open(r'd:/list.txt', 'w+', encoding='utf-8')
f.write(c)
Python盘符文件整理代码
最新推荐文章于 2024-11-05 10:04:47 发布