Python - String Constants
Last Updated: 2150Z 11SEP19 (Created: 2149Z 11SEP19)

Signatures:

All string constants are just strings of frequently referenced string values. They include:

string.ascii_letters
string.ascii_uppercase
string.ascii_lowercase
string.digits
string.hexdigits
string.octdigits
string.punctuation
string.printable
string.whitespace

Examples:

import string

def is_upper(word):
    for letter in word:
        if letter not in string.ascii_uppercase:
            return False

    return True

is_upper('Thanks Geir')     # False
is_upper('LOL')             # True

References:

  1. https://realpython.com/python-coding-interview-tips/#access-common-string-groups-with-string-constants
  2. https://docs.python.org/3/library/string.html