O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

string

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:

ConstantDescription
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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required