Python 2.7 输入文件路径显示' D:\wϰ\aa\66.mp4'
代码:traget=['.mp4','.rmvb','.avi']
vediolist=[]
temp1=input('请输入检查的目录:')
program_dir=os.getcwd()
def search_file(temp1,traget):
os.chdir(temp1)
list_file=os.listdir(os.curdir)
for each_file in list_file:
ext=os.path.splitext(each_file)
if ext in traget:
vediolist.append(os.getcwd()+os.sep+each_file+os.linesep)
if os.path.isdir(each_file):
search_file(each_file,traget)
os.chdir(os.pardir)
search_file(temp1,traget)
f=open('vediolist.txt','w')
f.writelines(vediolist)
f.close()
求教大神,如何输入正确的路径名
为什么还不升到最新版呢?
#encoding utf-8
traget=['.mp4','.rmvb','.avi']
vediolist=[]
temp1=input('请输入检查的目录:')
program_dir=os.getcwd()
def search_file(temp1,traget):
os.chdir(temp1)
list_file=os.listdir(os.curdir)
for each_file in list_file:
ext=os.path.splitext(each_file)
if ext in traget:
vediolist.append(os.getcwd()+os.sep+each_file+os.linesep)
if os.path.isdir(each_file):
search_file(each_file,traget)
os.chdir(os.pardir)
search_file(temp1,traget)
f=open('vediolist.txt','w')
f.writelines(vediolist)
f.close() 新手·ing 发表于 2017-10-21 22:18
谢谢 看来还有很多东西要学习啊! 看来还有很多东西要学习啊! 看来还有很多东西要学习啊! 看来还有很多东西要学习啊!
页:
[1]