[Tutor] AttributeError: 'list' object has no attribute 'capitalize'

Norman Khine norman at khine.net
Wed Jun 20 12:32:53 CEST 2007


Hello,
I would like to capitalize each word from an input form.

The problem is that the input form can be added as:

"HELLO world"
"hello world"
"HELLO WORLD"

etc..

If I do this:

>>> string = "HELLO world"
>>> print string.capitalize()
Hello world
>>>

only the first word gets capitalized.

My question is how to get all the words in the string to start with
capital letter?

Basically what I would like is to normalize the data input and store
this correctly in the database. Maybe there a simpler approach to this
data input problem.

Many thanks

Norman


More information about the Tutor mailing list