Hi All,

I had a feeling I could do this:

>>> foo
[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
>>> for c in foo:
...     for b in c:
...             print b
...
1
2
3
1
2
3
1
2
3

Using a list comprehension, as it seemed to me like I was saying: b
for c in foo, but I can't see how to do this.  Ultimately I want to
sum each number and produce a total.  I know how to do this as above,
but was wondering if there is an alternative / better way?

S.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to