ValueError: too many values to unpack

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed Apr 11 18:19:54 EDT 2007


Laszlo Nagy a écrit :
(snip)
> Try this instead:
> 
> lineno = 0
> for values in csvreader:
>    try:
>       lineno += 1

Laszlo, may I suggest using enumerate() here instead ?-)

for lineno, row in enumerate(csvreader):
   print "line %s" % lineno+1 # want 1-based numbering



More information about the Python-list mailing list