How to delete a file or folder?

前端 未结 13 1121
青春惊慌失措
青春惊慌失措 2020-11-22 12:29

How do I delete a file or folder in Python?

13条回答
  •  遇见更好的自我
    2020-11-22 13:18

    Use

    shutil.rmtree(path[, ignore_errors[, onerror]])
    

    (See complete documentation on shutil) and/or

    os.remove
    

    and

    os.rmdir
    

    (Complete documentation on os.)

提交回复
热议问题