Linux 技术手札

Python 复制及移动档案

Python 内建了复制档案及移动档案的功能.

Python 复制档案:

在 Python 复制档案可以用 shutil.copy(), 语法是:

shutil.copy(src,dst)

例子:

Python 移动档案

在 Python 用 os.rename() 移动档案, 语法跟 shutil.copy() 差不多:

os.rename(src, dst)

例子:

Exit mobile version