'capwords' is not a string method
thehaas at binary.net
thehaas at binary.net
Wed Jul 17 17:23:51 EDT 2002
Here is something I very recently discovered . . . "capwords" are not
included as a method of the string type, but "upcase" is:
>>> str = "python rocks"
>>> str.capwords()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'str' object has no attribute 'capwords'
>>> str.upper()
'PYTHON ROCKS'
But "capwords" *is* included in the string module:
>>> string.capwords(str)
'Python Rocks'
So I can still do it, but this seems a little inconsistant to me. Is
there a reason, or is it just an oversight??
-- mikeh
--
Mike Hostetler
thehaas at binary.net
http://www.binary.net/thehaas
GnuPG key: http://www.binary.net/thehaas/mikeh.gpg
More information about the Python-list
mailing list