so im learning some python but i got a list out of index error at this point if i put my header index to 0 it works not the way i see it works but ok, but if i get an upper index for header it wont can you help me out why?photo of my csv file
[heres the first picture of my code]and 2nd pic3
CodePudding user response:
When you put your header index as 0
what is output?
Assuming your delimiter is tab
with open("sample.csv", "r") as csvfile:
reader = csv.reader(csvfile,delimiter='\t')
headers = next(reader, None)
print(headers[1])
CodePudding user response:
My delimeter was \t after i changed it to it problem all solved