How to Make a List of the Alphabet in Python

In this tutorial, we will learn how to create a list of the alphabet in Python.

 

Lowercase Alphabet

The first step is to import the string package into your project. Then you can create a list of all the lowercase alphabet characters from the string.ascii_lowercase property like this:

 

import string

alpha_lower = list(string.ascii_lowercase)

print(alpha_lower)
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

 

Uppercase Alphabet

To get uppercase characters, use the string.ascii_uppercase property like this:

 

import string

alpha_upper = list(string.ascii_uppercase)

print(alpha_upper)
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

 

Upper and Lowercase Alphabet list

To create a list of both upper and lowercase alphabet characters, add the string properties together before creating the list like this:

 

import string

alpha_mixed = list(string.ascii_uppercase + string.ascii_lowercase)

print(alpha_mixed)
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
alphabet list