string() - Is this some kind of sick joke?

Andrew Koenig ark at research.att.com
Wed Apr 9 18:52:31 EDT 2003


Daniel> Observe from the 2.2.2 interpreter (and 2.2.1 in HPUX):

     >>> y="'hello'"
     >>> import string
     >>> string.strip(y,"'")
     Traceback (most recent call last):
     File "<interactive input>", line 1, in ?
     TypeError: strip() takes exactly 1 argument (2 given)

On the other hand, the following works just fine:

     >>> y = "'hello'"
     >>> str.strip(y,"'")
     'hello'

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list