Skip to content

Python list of letters a-z | How to make and print example

  • by

Use string.ascii_lowercase or string.ascii_uppercase to make a python list of letters a-z. A list of letters a-z means a list should contain all 26 letters of the alphabet.

import string

az_Upper = string.ascii_uppercase
print(az_Upper)

az_Lower = string.ascii_lowercase
print(az_Lower)

But its string contains the alphabet not a list of letters A-Z. To get List of letter from it use a loop and append methods.

Python list of letters a-z Example

Simply python example code creates a string of all uppercase or lowercase a-z letters and prints it.

You have to import the string module for it.

import string

az_Upper = string.ascii_uppercase
list1 = []
for i in az_Upper:
    list1.append(i)

print(list1)

Output:

Python list of letters a-z

If needed both lowercase and upper case letters then use

az_Letter = string.ascii_letters
print(az_Letter)

Do comment if you have any doubts and suggestions on this Python list topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading