sum function

Mike mike20007 at gmail.com
Thu Oct 4 20:40:49 EDT 2012


On Thursday, October 4, 2012 5:40:26 PM UTC-4, Dave Angel wrote:
> On 10/04/2012 05:29 PM, Mike wrote:
> 
> > I get below error
> 
> >
> 
> > NameError: name 'functools' is not defined
> 
> >
> 
> 
> 
> functools is a module in the standard library. You need to import it.
> 
> 
> 
> import functools
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> 
> 
> DaveA

I imported functools. Now I get the below error please.


Traceback (most recent call last):
  File "test.py", line 16, in <module>
    total = sum(float(col.value) for r in iter(next_r, None) for col in r.itervalues()) 
  File "test.py", line 16, in <genexpr>
    total = sum(float(col.value) for r in iter(next_r, None) for col in r.itervalues()) 
AttributeError: 'list' object has no attribute 'itervalues'

Thanks



More information about the Python-list mailing list