Python 将包含int和字符串的.dat文件连接在一起

Python 将包含int和字符串的.dat文件连接在一起,python,concatenation,Python,Concatenation,我可以访问一些类似以下内容的数据: """" Results are from 23 of March etc. etc more lines of rubbish 600 5245 234 21.2 244.0 505.00 Infinity -- 245 245.0 610 5555 134 24.0 244.0 505.00 Infinity -- 245 245.0 620 5235

我可以访问一些类似以下内容的数据:

"""" Results are from 23 of March etc. etc 
     more lines of rubbish 
     600     5245    234   21.2   244.0  505.00 Infinity  -- 245 245.0
     610     5555    134   24.0   244.0  505.00 Infinity  -- 245 245.0 
     620     5235    534   23.0   244.0  505.00 Infinity  -- 245 245.0 
"""""
基本上是行和列。我的目标是剪下最初的几条线,然后把其中的十几条缝在一起。我以后必须能够访问该文件的组件,我尝试过的大多数技术都只列出了一个很长的列表

lump_file = []

for file in os.listdir("../sif/specfit_output/2010_2011"):
    with open("../sif/specfit_output/2010_2011/"+file, 'r') as fi:
        lines = iter(fi.readline()[11:], '')
        lump_file.append(lines.next())

你的问题是?你的代码有错误吗?你能发布它或解释为什么生成的输出不是你想要的吗?哈,很好,我真的没有问任何问题,基本上我想弄清楚为什么我不能只使用'lines'变量并对…/2010\u 2011目录中的每个文件的每一行进行vstack,上面的代码给了我一个列表,其中每个变量都是file@DanielPenchev否,代码会给您一个TypeError,因为
iter()
的第一个参数必须是可调用的,而不是字符串。