Text Processing Modules

string

Provides ASCII character constants, Template substitution and customization of formatting through Formatter. Constants such as ascii_letters are deliberately ASCII, not a complete Unicode classification. Template substitutes named placeholders but is not an escaping or sanitization mechanism.

Formal Syntax & Structure

python syntaxpython
import string

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from string import Templateprint(Template("Order $number: $status").substitute(number=7, status="ready"))
Python Reference