Python String Capitalization
,I frequently copy titles from websites to use as anchor texts for links. However, these titles are often in all caps, and I don’t want to seem like I’m shouting. Previously, I would paste the all-caps title into a Python REPL, convert it to lowercase, and then manually capitalize the necessary words to make it look like a proper title. But today, I discovered a much simpler built-in solution:
>>> print("THIS IS A LOUD TITLE".title())
'This Is A Loud Title'
I had no idea about this function! 😅