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.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!