Error with string.strip

Stephen Boulet stepheb at comm.mot.com
Fri Apr 20 13:51:48 EDT 2001


Just van Rossum wrote:

> 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

Nevermind <hides head in shame>. I'm not sure what happened. I
thought I cut and pasted that exactly, but now in the script file I
wrote I noticed that "import string" statement was missing.

-- Stephen




More information about the Python-list mailing list