[ILUG] Python strip "]" from string
ollie at eillo.org
ollie at eillo.org
Tue Oct 7 19:55:49 IST 2008
Damn, i was hoping there was some obvious explanation. I just tried it on my pc at home and it seems to work.
Ill have another look, have to be missing something.
On Tue, 7 Oct 2008 19:31:30 +0200, Andrew McGill <glug at lunch.za.net> wrote:
> On Tuesday 07 October 2008 18:56:01 ollie at eillo.org wrote:
>> Hello,
>> For some reason Python refuses to strip a square bracket from a
>> string:
>>
>> string = "[test]"
>>
>>
>> string.strip("[") works fine
>> string.strip("]") refuses to work
> When it refuses to work, what does it do?
>
> It works for me (TM):
>
> # cat x.py
> string = "[test]"
> print string.strip("[")
> print string.strip("]")
>
> # python x.py
> test]
> [test
>
>> If i do a test in IDLE it works fine!
> You might have some strange UTF-8 in your source file that looks right,
> but
> isn't what you think it is.
More information about the ILUG
mailing list