00,0,6098
00,1,6098
00,2,6098
00,3,6098
00,4,6094
00,5,6094
00,6,6094
00,7,6094
00,8,6094
这是我的csv文件的片段。该文件包含大约465行,但当我阅读时,仅读取380行。这是我的代码:
import csv
import itertools
with open('lala.csv', 'r') as in_file:
lines = in_file.read().splitlines()
stripped = [line.replace(","," ").split() for line in lines]
grouped = itertools.izip(*[stripped]*1)
with open('lala.csv', 'w') as out_file:
writer = csv.writer(out_file)
for group in grouped:
writer.writerows(group)
file=open( "lala.csv", "r")
reader = csv.reader(file)
for line in reader:
print(line[2])