📜  python 如何删除包含文件的目录 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:24.399000             🧑  作者: Mango

代码示例1
import shutil

dir_path = '/tmp/img'

try:
    shutil.rmtree(dir_path)
except OSError as e:
    print("Error: %s : %s" % (dir_path, e.strerror))