Re: Removing a particular index from a list

2007-03-22 Thread Peter Otten
Steve Holden wrote: > Peter Otten wrote: >> Srikanth wrote: >> >>> list.remove(item) removes the first item from the list, but how do I >>> say to remove a particular index from a list without using it's value? >>> >>> Let's say I have 4 items in my list as >>> >> li = ["sri", "s", "srikanth"

Re: Removing a particular index from a list

2007-03-22 Thread Srikanth
Thanks Steve, Cyril and Peter. > > This, or not reading the tutorial. > > http://docs.python.org/tut/node7.html#SECTION00720 > > Peter I read this 2 months ago and I expected it to be a method of list, but I sound like I am making an excuse. Thanks a lot. Regards, Srikanth -- h

Re: Removing a particular index from a list

2007-03-22 Thread Steve Holden
Peter Otten wrote: > Srikanth wrote: > >> list.remove(item) removes the first item from the list, but how do I >> say to remove a particular index from a list without using it's value? >> >> Let's say I have 4 items in my list as >> > li = ["sri", "s", "srikanth", "s"] >> And if I want to remo

Re: Removing a particular index from a list

2007-03-22 Thread Peter Otten
Srikanth wrote: > list.remove(item) removes the first item from the list, but how do I > say to remove a particular index from a list without using it's value? > > Let's say I have 4 items in my list as > li = ["sri", "s", "srikanth", "s"] > > And if I want to remove the last item ("s"), h

Re: Removing a particular index from a list

2007-03-22 Thread Cyril Cheneson
>>> li = ["sri", "s", "srikanth", "s"] > And if I want to remove the last item ("s"), how do I remove it? > li.remove(-1) doesn't do it. This is my problem. > > Thanks, > Srikanth > li.pop() will remove the last element Cyril -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing a particular index from a list

2007-03-22 Thread Steve Holden
Srikanth wrote: > Hi, > > list.remove(item) removes the first item from the list, but how do I > say to remove a particular index from a list without using it's value? > > Let's say I have 4 items in my list as > li = ["sri", "s", "srikanth", "s"] > > And if I want to remove the last item