is there a better way...
Christopher Encapera
ChrisE at lantech.com
Fri May 10 11:16:55 EDT 2002
to loop over a list and replace an element based on its value than:
x = [1,2,3,4,5,6,7,8,9]
y = len(x)
z = 0
while z < y:
element = x[z]
if element == 5: x[z] = '678'
z = z +1
Another words is there a way to do this with a "for" statement - some method
that will return the current z (of x[z]) in the loop?
(My goal is to open Windows logon scripts and update the path to the latest
virus DAT's)
Thanks in advance!
Christopher Encapera
Lantech.Com
chrise at lantech.com
502-267-4200
More information about the Python-list
mailing list