str.upper in Python

Python Methods and Functions

Returns a copy of the original string with uppercase characters.

str.upper ()

-> str

Python 3
The uppercase algorithm is described in paragraph 3.13 of the Unicode standard.

< b> Python 2
For strings with 8-bits per character (unicode), the method depends on the current locale.

  'SoMe SlOnov' .upper () # SOME ELEPHANTS  

Use the lower () method to lowercase characters in a string .

Use isupper/"> isupper () to check if a string contains only uppercase characters.


str.upper (). isupper () may return False

  '12'.upper (). isupper () # False  

This behavior is possible, if the string contains only characters that do not support case conversion, or the Unicode category of the character (s) in the resulting string is not Lu (Letter, uppercase), but, for example, Lt ( Letter, titlecase). 

Get Solution for free from DataCamp guru