Python - Display text in lowercase or uppercase

December 2016



Several solutions exist:

Using the map( )function


Display text in lowercase
print map (chr, range (97, 123))

Display text in uppercase
print map (chr, range (65, 91))

Using the libraries


Display text in lowercase and uppercase letters:
from string import ascii_letters
print ascii_letters

Another alternative:
import string
print string.ascii_lowercase
print string.ascii_uppercase

Related :

This document entitled « Python - Display text in lowercase or uppercase » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.