我有这个巨大的文本文件,我想在分钟的顶部获取具有关联数据的行。这是来自该文本文件的几行。这是超过 36 小时的数据片段。我所说的关联是指时间戳后面的 8 个数据点。
2020-08-03 22:17:12,0,0,4803,4800,91,28.05,24.05,58.8917
2020-08-03 22:17:13,0,0,4802,4800,91,28.05,24.05,58.8925
2020-08-03 22:17:14,0,0,4805,4800,91,28.05,24.05,58.9341
2020-08-03 22:17:15,0,0,4802,4800,91,28.05,24.05,58.9683
2020-08-03 22:17:18,0,0,4802,4800,91,28.05,23.05,58.978
...
我找不到一种方法让 python 查看时间戳的秒部分,然后创建一个仅包含与“:00”秒相关联的数据的新列表。
for line in fh:
line = line.rstrip("\n")
line = line.split(",")
masterlist.extend(line) #this is putting the information into one list
altmasterlist.append(line) #this is putting the lines of information into a list
for line in altmasterlist:
if ":00" in line:
finalmasterlist.extend(line) #Nothing is entering this if statement
print(finalmasterlist)
我什至在这两个 for 循环的正确区域吗?
相关分类