W3docs

Alphabet range in Python

In Python, you can use the string module's ascii_lowercase and ascii_uppercase constants to get the range of lowercase and uppercase letters in the ASCII character set respectively.

In Python, you can use the string module's ascii_lowercase and ascii_uppercase constants to get the range of lowercase and uppercase letters in the ASCII character set respectively. Here is an example code snippet:

get the range of lowercase and uppercase letters in the ASCII character set respectively

python— editable, runs on the server

This will output:

alphabet

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ

You can also use the string.ascii_letters which will contain both the uppercase and lowercase letters.

string.ascii_letters

python— editable, runs on the server

This will output:

alphabet in one line

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ