Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 300 Bytes

20231212064158.md

File metadata and controls

19 lines (13 loc) · 300 Bytes

Use capwords for title-casing

Python's Title Casing Quirk 🐍

text = "don't stop"
print(text.title())  # Wrong: Don'T Stop

Fix with string.capwords() 😍

import string
print(string.capwords(text))  # Right: Don't Stop

Simple yet effective for accurate title casing!

#string