How to Use String upper() Method in PythonPython Basics


The upper() method converts lowercase letters in a string to uppercase letters.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

str = "have a nice day....wow!!!"
print ("str.upper(): ", str.upper())

Output:

str.upper():  HAVE A NICE DAY....WOW!!!

Syntax

str.upper()

Parameters

The method doesn’t take any parameters.

Return Value

It returns the uppercased string from the given string.

© 2024 Learnwithgpt.org, all rights reserved. Privacy Policy | Contact Us