嗨,我有几个相同布局的Jsonl文件 Folder
我想在文件夹中循环读取每个文件并合并到一个文件中。 在我使用的代码下面,它一直在运行
a=[]
for filepath in glob.iglob('C:\\Users\\txb1025\\Desktop\\Perso\\Challenges\\Daltix\\Data\\*.jsonl'):
for line in open(filepath, 'r'):
a.append(json.loads(line))```
any help would be very appreciated
您可以使用fileinput模块:
https://docs.python.org/3/library/fileinput.html &燃气轮机;读取每个文件并将其放入一个文件中
我从来没有迭代过我的文件夹并将多个文件放入其中,但您可能可以迭代该文件夹,将文件夹中的所有文件放入列表并传递该列表
我希望这就是你想要的
相关问题 更多 >
编程相关推荐