capitalize (word)
It has to be done. I understand it differently.
>>> mytext = u'i am a foobar bazbar' >>> mytext.capitalize() u'I am a foobar bazbar' >>>
Well, as said in the answer above, you have to make custom capital letters:
mytext = u'i am foobar bazbar '
def xcaptilize(word): skipList = ['a', 'an', 'the', 'am'] if word not in skipList: return word.capitalize() return word k = mytext.split(" ") l = map(xcaptilize, k) print " ".join(l)
Displays
I am a Foobar Bazbar
pyfunc Sep 16 '10 at 16:37 2010-09-16 16:37
source share