arrays - Python 3.3 IndexError doesn't make sense -



arrays - Python 3.3 IndexError doesn't make sense -

i have multidimensional array in py3.3, looks like

[ # big container [ # month container ['date string', 'temp'],['date string', 'temp'] #dates in month ], #close month container [ # next month container ['date string', 'temp'], ['date string', 'temp'] ] ]

here code:

dailydict = [] dailyrow = [] comparestation = 'myfile.csv' open(comparestation, newline='\n') csvfile: station = csv.reader(csvfile, delimiter=',', quotechar='|') row in station: if 1stdayofmonthcondition: dailydict.append(dailyrow) dailyrow = [] dailyrow.append(row) else: dailyrow.append(row) month in dailydict: print(month[1])

this gives me indexerror, list index out of range. however, when run print(month) each month printed out fine.

and when set printed month variable, say, x, in shell, can print(x[1]) fine. print(month[1]) still fails. confused.

thanks.

the index list starts @ 0 not 1 should seek print(month[0])to see if thing way

python arrays list multidimensional-array

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -