你可以使用shutil模塊中的copy或copy2函數來拷貝文件到文件夾。
下面是一個例子:
import shutil
# 拷貝文件到文件夾
src_file = 'path/to/source/file.txt'
dst_folder = 'path/to/destination/folder'
shutil.copy(src_file, dst_folder)
上面的代碼將會拷貝src_file到dst_folder中。
如果你想保留源文件的元數據(如修改時間和權限等),你可以使用copy2函數代替copy函數:
shutil.copy2(src_file, dst_folder)
這樣就會完整地拷貝文件,包括元數據。