Answers for "title in python"

7

python title case

string = 'this will be title case'
print(string.title())
#output: 'This Will Be Title Case'
Posted by: Guest on April-18-2020
0

title() in python

>>> import re
>>> def titlecase(s):
...     return re.sub(rb"[A-Za-z]+('[A-Za-z]+)?",
...                   lambda mo: mo.group(0)[0:1].upper() +
...                              mo.group(0)[1:].lower(),
...                   s)
...
>>> titlecase(b"they're bill's friends.")
b"They're Bill's Friends."
Posted by: Guest on August-11-2021

Python Answers by Framework

Browse Popular Code Answers by Language