use*_*181 1 delete-file python-3.x
如何使用Python 3删除文件夹中的所有png格式图片?
zea*_*soi 9
这种单一的行语句将每个文件在指定的路径,并删除它,如果文件名结尾的.png:
.png
import os os.remove(file) for file in os.listdir('path/to/directory') if file.endswith('.png')
归档时间:
12 年,5 月 前
查看次数:
15724 次
最近记录:
7 年,10 月 前