Re: Delete values from a string using the index

2007-09-27 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: How do I delete or remove values from a list or string using the index. Note you can't do it with a string, since that's not mutable. -- http://mail.python.org/mailman/listinfo/python-list

Delete values from a string using the index

2007-09-26 Thread koutoo
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete values from a string using the index

2007-09-26 Thread Ricardo Aráoz
[EMAIL PROTECTED] 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. del a[1] del a[-5] -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete values from a string using the index

2007-09-26 Thread Erik Jones
On Sep 26, 2007, at 3:25 PM, [EMAIL PROTECTED] 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. -- http://mail.python.org/mailman/listinfo/python-list l = [1, 2, 3]

Re: Delete values from a string using the index

2007-09-26 Thread Bjoern Schliessmann
[EMAIL PROTECTED] 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? del a[0:5] Be sure to check out the relevant section of the Python tutorial. http://docs.python.org/tut/node7.html

Re: Delete values from a string using the index

2007-09-26 Thread Ricardo Aráoz
[EMAIL PROTECTED] 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] -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete values from a string using the index

2007-09-26 Thread Bruno Desthuilliers
[EMAIL PROTECTED] 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 --