i am want to read data from the csv that i wrote using python csv module but apart from filed names and row count i am unable to read rest of the data
Peter Otten
__peter__ at web.de
Sun Apr 12 06:30:35 EDT 2020
Rahul Gupta wrote:
> for line in enumerate(csv_reader):
> print(line[csv_reader.fieldnames[1]])
enumerate() generates (index, line) tuples that you need to unpack:
for index, line in enumerate(csv_reader):
print(line[csv_reader.fieldnames[1]])
If you want to keep track of the row count you can modify the above like so:
row_count = 0
for row_count, line in enumerate(csv_reader, 1):
print(line[csv_reader.fieldnames[1]])
More information about the Python-list
mailing list