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
[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
--
http://mail.python.org/mailman
[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/pyth
[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.
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 = [
[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