How to Convert String to Uppercase in Python

Channel: Linux
Abstract: Some times you may require to convert any string to uppercase (all letters). This tutorial will help to convert a string (any case) to the upper case

Some times you may require to convert any string to uppercase (all letters). This tutorial will help to convert a string (any case) to the upper case as showing in the below image.

Convert String to Upper Case

Using Python programming language you can use string .upper() function to convert any string to upper case. Here is the sample Python code to convert string to uppercase.

>>> s = "Hello Python" >>> print(s.upper()) HELLO PYTHON1234>>> s = "Hello Python">>> print(s.upper()) HELLO PYTHON

Suggested reading

Some more examples of the string conversions in Python.

  • Convert String to Lowercase in Python

Ref From: tecadmin
Channels: Python

Related articles