Python String upper() Method
The Python upper() method converts lowercase letters in a string to uppercase.
Python String upper() Syntax
Syntax of the upper() method.
str.upper()
Python String upper() Parameters
- None.
Python String upper() Return Value
Returns a string with lowercase letters converted to uppercase letters.
Python String upper() Example#1
The following example demonstrates the use of the upper() function for strings with only alphabetic characters.
text = 'demos For api'
print("Original String:")
print(text)
print("\nConverted String:")
print(text.upper())
Output:
Python String upper() Example#2
String with alphanumeric characters:
text = 'demo5s f0r ap4i'
print("Original String:")
print(text)
print("\nConverted String:")
print(text.upper())
Output: