The string module contains a number of useful constants and functions for manipulating strings. Most of the functionality of this module is also available in the form of string methods. The following constants are defined:

ascii_lettersA string containing all lowercase and uppercase ASCII letters.
ascii_lowercaseThe string 'abcdefghijklmnopqrstuvwxyz'.
ascii_uppercaseThe string 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
digitsThe string '0123456789'.
hexdigitsThe string '0123456789abcdefABCDEF'.
lettersConcatenation of lowercase and uppercase.
lowercaseString containing all lowercase letters specific to the current locale setting.
octdigitsThe string '01234567'.
punctuationString of ASCII punctuation characters.
printableString of printable ...

Get Python: Essential Reference, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.