我想从包含 NVSS 关键字的txt文件中提取整行,并将其导出为新的txt文件,但我不知道如何执行此操作。 谢谢
答案 0 :(得分:0)
提取包含' NVSS'的每一行。到一个新文件:
with open('infile.txt', 'r') as infile, open('outfile.txt', 'w') as outfile:
for line in infile:
if 'NVSS' in line:
outfile.write(line)