strip not working on strings?

2005-11-13 Thread dan . j . weber
I'm using Python 2.3.5 and when I type the following in the interactive prompt I see that strip() is not working as advertised: >>>s = 'p p:p' >>>s.strip(' :') 'p p:p' Is this just me or does it not work? I want to get rid of all ' ' and ':' in the string. I've checked the doc and from what I can

So what are __slots__ and when should I use them?

2005-11-15 Thread dan . j . weber
I see some programs declaring the names of class variables in "__slots__". I've looked this up and the docs say something about old and new style classes, whatever that means. Can someone give me a simple, brief explanation of what __slots__ are and when I should use them? Thanks. -- http://mail.

Reading a file in same directory as code with relative path

2005-11-17 Thread dan . j . weber
I'm trying to read an XML file in the same directory as my python code, using minidom: document = xml.dom.minidom.parse("data.xml") How can I read in the file "data.xml" without knowing it's full path--just that it's in the same directory as my code file? Thanks for any help with this. I'm new to