E
EP
In fear of bringing down the quality of the list, I nevertheless will ask:
How I can tell where I am in a for loop?
I think I am working way too hard to try to determine this - there is
probably a very simple way to know?
Spam_locations=[]
list=['linguine','Spam', 'clams', 'Spam', 'steak', 'onions', 'apples', 'Spam']
for food in list:
if food='Spam':
Spam_location.append(## position in list ##) ## but how do I
back reference the position in the for loop?
I am hoping to get:
[1,3,7]
I was thinking the back reference might be something like:
Spam_location.append(list.__iter__())
But that gives me <listiterator object at 0x00DBE3B0> not a value (position)...
I promise to be smarter next year... any help?
EP
How I can tell where I am in a for loop?
I think I am working way too hard to try to determine this - there is
probably a very simple way to know?
Spam_locations=[]
list=['linguine','Spam', 'clams', 'Spam', 'steak', 'onions', 'apples', 'Spam']
for food in list:
if food='Spam':
Spam_location.append(## position in list ##) ## but how do I
back reference the position in the for loop?
I am hoping to get:
[1,3,7]
I was thinking the back reference might be something like:
Spam_location.append(list.__iter__())
But that gives me <listiterator object at 0x00DBE3B0> not a value (position)...
I promise to be smarter next year... any help?
EP