LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Python strip "]" from string

[ILUG] Python strip "]" from string

Andrew McGill glug at lunch.za.net
Tue Oct 7 18:31:30 IST 2008


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
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell