On Fri, Aug 28, 2009 at 11:20 AM, vince spicer<[email protected]> wrote:

> Or even cleaner with list comprehension
>
> def pack(foo):
>     return [x for x in enumerate(foo, 1)]

Or just list(enumerate(foo, 1))

For Python 2.5 use
[ [i+1, x] for i, x in enumerate(foo) ]

Kent
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to