Answers for "capitalize the entered letter python"

19

capitalize string python

# Python string capitalization
string = "this isn't a #Standard Sntence."
string.capitalize() # "This isn't a #standard sentence."
string.upper() # "THIS ISN'T A #STANDARD SENTENCE."
string.lower() # "this isn't a #standard sentence."
string.title() # "This Isn'T A #Standard Sentence."

# ---------- Alternate Title Case ----------
# "This Isn't A #standard Sentence."

from string import capwords
string = capwords(string) # capitalize characters after each separator.
# see the doc: string.capwords(s, sep=None), separator defaults to space

# or implement it directly:
string = " ".join(s.capitalize() for s in string.split())
#
Posted by: Guest on December-01-2020
0

python input without capital letters

# Python has a lower() function to convert
#an uppercase string to an identical lowercase string

string = 'MY STRING IN CAPITAL LETTERS'
print(string.lower())
#or:
string = 'My String In Capital Letters'
print(string.lower())

#OUTPUT: 
#my string in capital letters
#my string in capital letters
Posted by: Guest on July-06-2021

Code answers related to "capitalize the entered letter python"

Python Answers by Framework

Browse Popular Code Answers by Language