I get this error even though my file has only two columns and I used them.
This is my code:
f_in = open('State_Deaths.csv', 'rt')
state_deaths = []
for line in f_in:
line = line.strip()
print(line)
state, deaths = line.split(',')
state_deaths += state, deaths
print(state_deaths)
This is a part of the file :
state, deaths
Wyoming,155
Mississippi,641
Arkansas,563
Montana,189
Alabama,862
Oklahoma,668
Kentucky,760
South Carolina,810
South Dakota,140
West Virginia,315
state_deathsto be a list of two-element tuples such as[(state1,deaths1), (state2,deaths2)], or a flat list such as[state1,deaths1,state2,deaths2]?