title-case

Any difference between str.capitalize() and str.title()?

Any difference between str.capitalize() and str.title()? Question: Is there any difference in str.title() vs str.capitalize()? My understanding from the docs is that both methods capitalize the first letter of a word and make the rest of the letters lowercase. Did anyone run into a situation where they cannot be used interchangeably? Asked By: mysl || …

Total answers: 3

Titlecasing a string with exceptions

Titlecasing a string with exceptions Question: Is there a standard way in Python to titlecase a string (i.e. words start with uppercase characters, all remaining cased characters have lowercase) but leaving articles like and, in, and of lowercased? Asked By: yassin || Source Answers: There are these methods: >>> mytext = u’i am a foobar …

Total answers: 9