November 6th, 2012, 01:49 PM
List.index Is is printable?
Hello! I was codeing and I stumbled upon a problem.
I want to change an attribute of one object, within a class.
These objects are also added to a list, so what I do when i want to change them is to do that using the objects index number.
THE QUESTION: Is there anyway to print the index number of every object in the list?
I know i can write it like - print (testlist.index(object))
But that is just one of the objects !
All help is appreciated!
November 6th, 2012, 02:20 PM
for t in enumerate(LIST):
print('str(LIST[%d]) == %s'%t)
for i in range(len(LIST)):
[/code] are essential for python code and Makefiles!
November 6th, 2012, 02:53 PM