In this lesson, you’ll learn about the string
module. This module will help you quickly access some string constants. Here’s an example:
>>> import string
>>> string.digits
'0123456789'
>>> string.ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
Here are some useful constants:
string.ascii_letters
string.ascii_uppercase
string.ascii_lowercase
string.digits
string.hexdigits
string.octdigits
string.punctuation
string.printable
string.whitespace
You can check out the Python documentation on the string
module.
abhinav on Jan. 7, 2021
I’m having trouble understanding why the
all
statement stops after the first print.