I have a simple question. If I have a for loop in python as follows:
for name in nameList:
How to find out what an index is for an element name? I know I can do something like:
i = 0
for name in nameList:
i= i + 1
if name == "something":
nameList[i] = "something else"
I just feel that there should be a more readable way to do this ...
source
share