0
点赞
收藏
分享

微信扫一扫

python中删除文档的方法是什么

yellowone 2023-02-16 阅读 70

python中删除文档的方法是什么_Python

Python中删除文档的方法有以下几种:

1. 使用os模块的remove()函数:

import os

os.remove(“/path/to/document”)

2. 使用shutil模块的rmtree()函数:

import shutil

shutil.rmtree(“/path/to/folder”)

3. 使用glob模块的glob()函数:

import glob

for f in glob.glob(“/path/to/document”):
os.remove(f)

举报

相关推荐

0 条评论