am i missing something ?

shagshag13 shagshag13 at yahoo.fr
Sat Apr 12 16:31:24 CEST 2003


hello,

i would like to strip only non white space from a string, i have found strip
in documentation as :

strip([chars])
Return a copy of the string with leading and trailing characters removed. If
chars is omitted or None, whitespace characters are removed. If given and
not None, chars must be a string; the characters in the string will be
stripped from the both ends of the string this method is called on.

but i can't get it work :

>>> s = 'this is an example \n'
>>> s.strip("\n")
Traceback (most recent call last):
  File "<pyshell#184>", line 1, in ?
    s.strip("\n")
TypeError: strip() takes no arguments (1 given)

i think i'm missing something...






More information about the Python-list mailing list