Removing a particular index from a list
Peter Otten
__peter__ at web.de
Thu Mar 22 09:49:43 EDT 2007
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", "s"]
>>> And if I want to remove the last item ("s"), how do I remove it?
>>> li.remove(-1) doesn't do it.
>>
>> del li[-1]
>>
>>> This is my problem.
>>
>> This, or not reading the tutorial.
>>
> No, that's OUR problem :-)
And the fact that it's our /self-inflicted/ problem makes it all the more
severe :-)
Peter
More information about the Python-list
mailing list