Python String upper() Method


Contents

Description

This upper() method in Python string returns the copy of the string where all the case-based characters have been uppercased. In Python, the upper() method refers to a built-in method which is used for string handling. The upper() method in Python string returns the uppercase string from the string provided. It turns all the lowercase characters into uppercase. In case no lowercase characters exist,then it would return the original string.

Syntax

Following is the syntax for upper() method:

str.upper()

Parameters

  • NA

Return Value

This method returns a copy of the string where all the case-based characters have been uppercased.

Example

The following example below shows the usage of upper() method.

#!/usr/bin/python

str = "this is string example....wow!!!";
print "str.capitalize() : ", str.upper()

When the above above program is run, it produces the following result:

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.



Navigation
Tutorial
Tutorial
Tutorial