There is also this way:
for index in range(len(someList)):
someList[index] = 1
This is not as pretty or concise as enumerate(), but if you've never
seen that function before this may be more clear. I assume you're
familiar with the way range and len work.
THN
--
http://mail.python.org/mai
chun ping wang wrote:
> i want to modify an iterator value.
>
> for x in someList
>x = 1
for index, value in enumerate(someList):
someList[index] = 1
--
http://mail.python.org/mailman/listinfo/python-list
Hi, I have something simple i want to do.
i want to modify an iterator value.
for x in someList
x = 1
is it possible to do that..if not how do i modify a list using iteration.
_
Express yourself instantly with MSN Messenger! Do