I have a csv file and am trying to get one specific value on, say, line 20, column 3.
But so far, all I managed is to display all values on column 3 (here c
if you only know the column number and the line number you can do like this:
TheRow = 2 # Note that row 1 is the header row
TheColumn = 2 # first column == 0
for row in d:
if d.line_num == TheRow:
print("row %s: %s" % (str(d.line_num), str(row) ) )
print( row[d.fieldnames[TheColumn]] )
output:
row 2: {'t1': '12', 't2': '23', 't3': '31'}
31