Python 複製及移動檔案


Python 內建了複製檔案及移動檔案的功能.

Python 複製檔案:

在 Python 複製檔案可以用 shutil.copy(), 語法是:

shutil.copy(src,dst)

例子:

Python 移動檔案

在 Python 用 os.rename() 移動檔案, 語法跟 shutil.copy() 差不多:

os.rename(src, dst)

例子:

Tags:

Leave a Reply