从txt文件python中提取

时间:2018-06-06 09:11:03

标签: python

我从txt.file中提取了由于注释而跳过前几行的行。在这之后,我有一组列表。如何只获取第一个索引的值并将其附加到新列表中?

['364.00', '0.000', '0.000', '364.00', '28.00', '28.00', '0.00', '0.00']

['450.00', '0.000', '360.000', '450.00', '28.00', '28.00', '0.00', '0.00'] ['590.00', '0.000', '360.000', '590.00', '28.00', '28.00', '0.00', '0.00']

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

你是什么意思"列表组"?对于列表列表,可以这样做:

fill:"currentColor"

输出: lists = [['450.00', '0.000', '360.000', '450.00', '28.00', '28.00', '0.00', '0.00'], ['590.00', '0.000', '360.000', '590.00', '28.00', '28.00', '0.00', '0.00']] first_entries = [i[0] for i in lists] print(first_entries)