Python String Lowercase Uppercase

Python lower() method converts string to its lower case format. Python upper() method converts string to its upper case format.

>>> x = "Python Tutorial"
>>> x.lower()
'python tutorial'
>>> x = "Python Tutorial"
>>> x.upper()
'PYTHON TUTORIAL'
Upper case the first letter of the string:
>>> x = 'python tutorial'
>>> x.capitalize()
'Python tutorial'
Upper case the first letter of all words in the string:
>>> x.title()
'Python Tutorial'
To convert a list of strings into lower or upper case:

>>> str = ['endmemo', 'python','tutorial']
>>> [x.upper() for x in str]
['ENDMEMO','PYTHON','TUTORIAL']












endmemo.com © 2024  | Terms of Use | Privacy | Home