List index question

2005-12-07 Thread questions?
I want to do list index function. y=['1','2','3','4'] y ['1', '2', '3', '4'] y.index['2'] Traceback (most recent call last): File stdin, line 1, in ? TypeError: unsubscriptable object It works with y=[1,2,3,4]. Anyone has any hint, what's the reason here? thanks --

Re: List index question

2005-12-07 Thread Heiko Wundram
questions? wrote: I want to do list index function. y=['1','2','3','4'] y ['1', '2', '3', '4'] y.index['2'] Traceback (most recent call last): File stdin, line 1, in ? TypeError: unsubscriptable object It works with y=[1,2,3,4]. Anyone has any hint, what's the reason here? You're

Re: List index question

2005-12-07 Thread questions?
sorry, I realized the problem already. sorry for the confusion. THanks for the answer!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: List index question

2005-12-07 Thread Fredrik Lundh
questions? wrote: I want to do list index function. y=['1','2','3','4'] y ['1', '2', '3', '4'] y.index['2'] make that: y.index('2') /F -- http://mail.python.org/mailman/listinfo/python-list

Re: List index question

2005-12-07 Thread mrmakent
What you mean to do is y.index('2'), rather than y.index['2']. Call the index method of the list, rather than try to use index as if it was itself a list. -- http://mail.python.org/mailman/listinfo/python-list

Re: List index question

2005-12-07 Thread mrmakent
What you mean to do is y.index('2'), rather than y.index['2']. Call the index method of the list, rather than try to use index as if it was itself a list. -- http://mail.python.org/mailman/listinfo/python-list