python操作文件库shutil,好用不要钱

shutil是一个很好的用于自动测试的Unix shell和环境管理工具包。
安装也非常放方便:

pip install pytest-shutil

拷贝:

# 将一个路径下的部分图片拷贝到其他路径下
import shutil
shutil.copy(src, dst)
# 其中src为源地址,dst为目标地址。

dst既可以更改文件名,也可以保持不变。真的是很方便。谁用谁知道!

猜你喜欢

转载自blog.csdn.net/xinxiang7/article/details/105492371