How to change a string into uppercase How to change a string into uppercase python python

How to change a string into uppercase


>>> s = 'sdsd'>>> s.upper()'SDSD'

See String Methods.


To get upper case version of a string you can use str.upper:

s = 'sdsd's.upper()#=> 'SDSD'

On the other hand string.ascii_uppercase is a string containing all ASCII letters in upper case:

import stringstring.ascii_uppercase#=> 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


to make the string upper case -- just simply type

s.upper()

simple and easy! you can do the same to make it lower too

s.lower()

etc.