ファイル名がfile_1.txt, file_2.txt, file_3.txt .....file_n.txt
のディレクトリにn
というファイルがあるとします。私は個別のPythonにインポートし、それらにいくつかの計算を行い、その後、n
対応する出力ファイルに結果を保存したいと思います:file_1_o.txt, file_2_o.txt, ....file_n_o.txt.
ファイル名が異なる複数のファイルをエクスポートする
私は複数のファイルをインポートする方法を考え出した:
import glob
import numpy as np
path = r'home\...\CurrentDirectory'
allFiles = glob.glob(path + '/*.txt')
for file in allFiles:
# do something to file
...
...
np.savetxt(file,) ???
出力ファイルがfile_1_o.txt