Alan Gauld wrote:
> "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote
>
>> sorry, forgot a piece of the code :
>>
>> s = list(s)
>> while s[0].isspace() :
>> while s[-1].isspace() :
>> del s[-1]
>> del s[0]
>> s = ''.join(s)
>
> It still won't work. Strings are immutable, you can't use del
> to delete a character. Try it.
It comes straight from Idle (still warm ;-) ). Notice s = list(s) and s
= ''.join(s), so I'm not using del with strings but with a list and that
is ok. Try it, it does work.
>
>>>> del('foo'[-1])
> Traceback (most recent call last):
> File "<input>", line 1, in ?
> TypeError: object doesn't support item deletion
>
Not what I'm doing.
Cheers
Ricardo
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor