我正在尝试将一个字符串列表作为glob的输入,并将每个输入字符串的结果写为单独的.txt文件,但到目前为止还没有成功,我搜索了其他问题但似乎没有在循环中循环,我想我将需要?感谢
import os
import glob
# Generate a list of modis data julian days
julian_days = []
for day in range(1,365, 8):
julian_days.append(str('MOD09A1.A2015' + (str('{:03d}'.format(day))) +'*.hdf'))
for day in julian_days:
results = glob.glob(str(day))
myfile = open(((str(day[:-5])) + '.txt'), "w")
for line in results:
myfile.write(results, lineterminator='\n')