Delete values from a string using the index

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sun Sep 23 12:08:40 EDT 2007


koutoo at hotmail.com a écrit :
> How do I delete or remove values from a list

del

> or string

You can't. Python's strings are immutables.

> 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?

del a[0:5]
print a




More information about the Python-list mailing list