ItSolutionStuff.com

How to Create an Alphabet List in Python?

By Hardik Savani • October 30, 2023
Python

Hi Guys,

I am going to show you an example of python get all alphabets. I explained simply step by step how to make alphabet letters list in python. you can understand a concept of python list of alphabets. This example will help you how to make alphabet list in python.

We can use string library to get alphabet list in python. string library provide string.ascii_lowercase, string.ascii_letters and string.ascii_uppercase attribute to make list of alphabet letters in python. let's see the one by one example:

Example 1:

main.py

import string
  
# Get All Alphabet List in Lowercase in Python
alphabets = list(string.ascii_lowercase)
print(alphabets)

Output:

['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']

Example 2:

main.py

import string
  
# Get All Alphabet List in Uppercase in Python
upperAlphabets = list(string.ascii_uppercase)
print(upperAlphabets)

Output:

['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']

Example 3:

main.py

import string
  
# Get All Alphabet List in Uppercase & Lowercase in Python
letters = list(string.ascii_letters)
print(letters)

Output:

['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']

I hope it can help you...

Tags: Python
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Get Smallest Number in List Python?

Read Now →

Python Remove Character from List of Strings Example

Read Now →

How to Replace Value in Python List?

Read Now →

Python Generate List of Random Float Numbers Example

Read Now →

How to Create a List of Numbers from 1 to 100 in Python?

Read Now →

How to Get Last n Elements of a List in Python?

Read Now →

Python Remove Last 2, 3, 4, 5, 10, etc Elements from List Example

Read Now →

Python Dictionary Convert Keys to List Example

Read Now →

Python List Add Element at Beginning Example

Read Now →

How to Add Element at the End of List in Python?

Read Now →

How to Add Element at Specific Index in Python List?

Read Now →

How to Add Element to a List in Python?

Read Now →

Python List Print All Elements Except First Example

Read Now →

Python List Print All Elements Except Last Example

Read Now →