sum function

Ian Kelly ian.g.kelly at gmail.com
Thu Oct 4 20:59:03 EDT 2012


On Thu, Oct 4, 2012 at 6:40 PM, Mike <mike20007 at gmail.com> wrote:
> 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'

"r.itervalues()" should have been "r[0].columns.itervalues()", I
think.  It's hard to test code against an API that you don't have. :-)



More information about the Python-list mailing list