【发布时间】:2015-04-24 18:45:02
【问题描述】:
我想删除文件夹中的文件,但出现错误。
我的代码
for f in glob ('sub/*.sub'):
subprocess.call(["php", "AES.class.php" , f])
shutil.rmtree(f)
#deplacement des fichier
for d in glob ('*.ass'):
shutil.move(d, 'sync')
它给了我以下错误:
Traceback (most recent call last):
File "start.py", line 26, in <module>
shutil.rmtree(f)
File "/usr/lib64/python2.7/shutil.py", line 239, in rmtree
onerror(os.listdir, path, sys.exc_info())
File "/usr/lib64/python2.7/shutil.py", line 237, in rmtree
names = os.listdir(path)
OSError: [Errno 20] Not a directory: 'sub/Ep01.sub'
如何删除文件夹中扩展名为.sub的文件?
【问题讨论】:
标签: python glob shutil eoserror