Easy Tutorial
❮ Python Func Exec Python Func Number Fabs ❯

Python String Case Conversion

Python3 Examples

The following code demonstrates how to convert a string to uppercase, or to lowercase, and more:

# Filename : test.py
# author by : www.tutorialpro.org

str = "www.tutorialpro.org"
print(str.upper())          # Converts all lowercase letters to uppercase
print(str.lower())          # Converts all uppercase letters to lowercase
print(str.capitalize())     # Converts the first letter to uppercase and the rest to lowercase
print(str.title())          # Converts the first letter of each word to uppercase and the rest to lowercase

Executing the above code produces the following output:

WWW.TUTORIALPRO.ORG
www.tutorialpro.org
Www.tutorialpro.org
Www.tutorialpro.org

Python3 Examples

❮ Python Func Exec Python Func Number Fabs ❯