用到了如下模块:
import os, shutil
其中shutil
是shell util
的缩写。
创建目录
os.makedirs
,相当于shell里的mkdir -p
,但是如果已经存在则会报错。
os.makedirs(dirname, exist_ok = True)
使得即使目录存在也不报错。复制文件
shutil.copyfile
移动
shutil.move
判断文件是否存在
- 其他
用到了如下模块:
其中shutil
是shell util
的缩写。
创建目录
os.makedirs
,相当于shell里的mkdir -p
,但是如果已经存在则会报错。
os.makedirs(dirname, exist_ok = True)
使得即使目录存在也不报错。
复制文件
shutil.copyfile
移动
shutil.move
判断文件是否存在
Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
©2021-
searchstar
|
pv
|
uv
Theme Tree
by WuJun
Powered by Hexo