指定されたフォルダにファイルをコピーするには、Pythonで「 shutil.copy() 」を使用します。
ファイル指定ディレクトリにshutilモジュールを用いてコピーします。サンプルコード:
import shutil
# 源文件路径
source_file = "/path/to/source/file.txt"
# 目标文件夹路径
destination_folder = "/path/to/destination/folder/"
# 复制文件到目标文件夹
shutil.copy(source_file, destination_folder)
上にある例では、/path/to/source/file.txt を実際のソースファイルのパスに置き換え、/path/to/destination/folder/ を実際の出力先のフォルダのパスに置き換える必要があります。