Skip to main content

Module str

Module str 

Source

Enums§

Quote
Enumeration of the two kinds of quotes that can be used for Python string/f/t-string/bytestring literals
TripleQuotes

Constants§

SINGLE_QUOTE_BYTE_PREFIXES
SINGLE_QUOTE_TEMPLATE_PREFIXES
TRIPLE_QUOTE_BYTE_PREFIXES
Includes all permutations of b and rb. This includes all possible orders, and all possible casings, for both single and triple quotes.
TRIPLE_QUOTE_TEMPLATE_PREFIXES
Includes all permutations of t and rt. This includes all possible orders, and all possible casings, for both single and triple quotes.

Functions§

is_triple_quote
Return true if the string is a triple-quote string or byte prefix.
leading_quote
Return the leading quote for a string, template, or bytes literal (e.g., """).
raw_contents
Strip the leading and trailing quotes from a string. Assumes that the string is a valid string literal, but does not verify that the string is a “simple” string literal (i.e., that it does not contain any implicit concatenations).
raw_contents_range
trailing_quote
Return the trailing quote string for a string, template, or bytes literal (e.g., """).