Re: pythonic way
thanks,but I don't think enumerate() is my want
Have some ways to operate the reference of element,not a copy when I
tried to traverse a list?
I'm so sorry about my poor English, hope you don't mind it.
On 2012/11/2 15:56, Chris Angelico wrote:
> On Fri, Nov 2, 2012 at 6:14 PM, jack <firstname.lastname@example.org> wrote:
>> Sometimes, I need to alter the element as traverse a list like this (it's a
>> c = range(10)
>> i = 0
>> for ele in c:
>> # do something
>> # branch:
>> c[i] = # value
>> i += 1
>> How to be pythonic？
> Check out the enumerate() function.
|All times are GMT. The time now is 12:02 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.