How can I capitalize the first letter of each word in a string in Python?
import string x = "they're bill's friends from the UK" x = string.capwords(x) print(x) x = x.title() print(x)
Output
They're Bill's Friends From The Uk They'Re Bill'S Friends From The Uk