我目前正在对 csv 文件进行排序。就我的输出而言,它是正确的,但格式不正确。以下是我整理的文件
这是我排序后的输出(我将在图像后包含代码)
显然我有一个分隔符问题,但这是我的代码:
with open(out_file, 'r') as unsort:##Opens OMI Data
with open(Pandora_Sorted,'w') as sort:##Opens file to write to
for line in unsort:
if "Datetime" in line:##Searches lines
writer=csv.writer(sort, delimiter = ',')
writer.writerow(headers)##Writes header
elif "T13" in line:
writer=csv.writer(sort)
writer.writerow(line)##Writes to output file
千巷猫影
相关分类