Thanks for the replies. Though the list comprehension does not work:
TypeError: enumerate() takes exactly 1 argument (2 given)
On Aug 29, 2009, at 12:20 AM, vince spicer wrote:
#print foohough I didn't test your code, I think what you are
trying to accomplish can be done using enumerate cleaner
def pack(foo):
out = []
for x,y in enumerate(foo, 1):
out.append((x,y))
return out
Or even cleaner with list comprehension
def pack(foo):
return [x for x in enumerate(foo, 1)]
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor