Format is like:
CHINA;2002-06-25 00:00:00.000;5,60
CHINA;2002-06-26 00:00:00.000;5,32
CHINA;2002-06-27 00:00:00.000;5,31
and I try to use Python's CSV tools to parse it but cannot understand the paragraph, source:
And while the module doesn’t directly support pars开发者_如何学运维ing strings, it can easily be done:
import csv
for row in csv.reader(['one,two,three']):
print row
Could someone clarify the line ['one,two,three']
? How would you use it with format A;B;C
?
The docs you quote are talking about the difference between parsing csv data stored in a file, and csv data stored in a string. It doesn't have to do with the format of the data.
You should be able to read your data with something like:
import csv
csv_reader = csv.reader(open('data.csv', 'rb'), delimiter=';')
for row in csv_reader:
# do something with row....
精彩评论