Error with string.strip

Just van Rossum just at letterror.com
Fri Apr 20 12:32:57 EDT 2001


Stephen Boulet wrote:
> > > >>> import string
> > > >>> string.strip("all's well as ends well     ")
> > > "all's well as ends well"
> > > >>> string.strip(" 15157 ?         0:01 ttsession\012")
> > >   File "<stdin>", line 1
> > >     string.strip(' 15157 ?         0:01 ttsession\012')
> > >                                                        ^
> > > SyntaxError: invalid syntax
> > >
> 
> Hmm. I'm using 1.5.1 for HPUX 10.x. Maybe I need to upgrade...

Hm, it works even in Python 1.5:

Python 1.5 (#13, Jun 15 1998, 17:37:50)  [GCC 2.7.2.1] on bsdos4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import string
>>> string.strip(" 15157 ?         0:01 ttsession\012")
'15157 ?         0:01 ttsession'
>>>

Just



More information about the Python-list mailing list