python to title case code example
Example 1: python title case
string = 'this will be title case'
print(string.title())
#output: 'This Will Be Title Case'
Example 2: title case with apostrophe in python
import re
def titlecase(s):
return re.sub(r"[A-Za-z]+('[A-Za-z]+)?",
lambda mo: mo.group(0).capitalize(),
s)