Delete values from a string using the index

Ricardo Aráoz ricaraoz at gmail.com
Wed Sep 26 16:47:58 EDT 2007


koutoo at hotmail.com wrote:
> How do I delete or remove values from a list or string using the
> index.
> 
> If a = [1,2,3,4,5,6,7,8] and I want to get rid of 1 -5, how would I do
> that?
> 
> Thanks.
> 

If you want to do it all at once :

del a[1:4:2]



More information about the Python-list mailing list