Search
Searching for multiple words only shows matches that contain all words.
String literals prefixed with 'f'
or 'F'
are commonly called
“f-strings” which is short for
formatted string literals. See also PEP 498.
Searching
- Glossary
f-string
- string (Python module, in
string
— Common string operations) - stringprep (Python module, in
stringprep
— Internet String Preparation) - PyByteArray_FromStringAndSize.string (C function parameter, in Byte Array Objects)
- PyBytes_AS_STRING.string (C function parameter, in Bytes Objects)
- PyUnicode_CompareWithASCIIString.string (C function parameter, in Unicode Objects and Codecs)
- PyUnicode_EqualToUTF8.string (C function parameter, in Unicode Objects and Codecs)
- PyUnicode_EqualToUTF8AndSize.string (C function parameter, in Unicode Objects and Codecs)
- re.Match.string (Python attribute, in
re
— Regular expression operations) - token.STRING (Python data, in
token
— Constants used with Python parse trees) ipaddress
— IPv4/IPv6 manipulation library...her or not two hosts are on the same subnet, iterating over all hosts in a particular subnet, checking whether or not a string represents a valid IP address or network definition, and so on. This is the full module API reference—for an over...
optparse
— Parser for command line options...iar with these conventions, reading this section will allow you to acquaint yourself with them. Terminology argumenta string entered on the command-line, and passed by the shell to execl() or execv(). In Python, arguments are elements of...
re
— Regular expression operations...Lib/re/ This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings (str) as well as 8-bit strings (bytes). However, Unicode strings and 8-bit...
string
— Common string operationsstring — Common string operations Source code: Lib/string.py See also Text Sequence Type — str String Methods String constants The constants defined in this module are: string.ascii_letters The concatenation of the as...
stringprep
— Internet String Preparationstringprep — Internet String Preparation Source code: Lib/stringprep.py When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for “equality”. Exactly how this c...
struct
— Interpret bytes as packed binary data...truct.py This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversions to/from Python values. The module’s functions and objects can be used for two...
subprocess
— Subprocess management...argument is passed to Popen.communicate() and thus to the subprocess’s stdin. If used it must be a byte sequence, or a string if encoding or errors is specified or text is true. When used, the internal Popen object is automatically create...
zoneinfo
— IANA time zone support...ath by specifying the compile-time option TZPATH (or, more likely, the configure flag --with-tzpath), which should be a string delimited by os.pathsep. On all platforms, the configured value is available as the TZPATH key in sysconfig.get_c...
- 10. Brief Tour of the Standard Library
...s) <returns a list of all module functions> >>> help(os) <returns an extensive manual page created from the module's docstrings> For daily file and directory management tasks, the shutil module provides a higher level interface that is ea...
- 2. Lexical analysis
...Physical lines A physical line is a sequence of characters terminated by an end-of-line sequence. In source files and strings, any of the standard platform line termination sequences can be used - the Unix form using ASCII LF (linefeed),...
- 4. More Control Flow Tools
...teration step and halting condition (as C), Python’s for statement iterates over the items of any sequence (a list or a string), in the order that they appear in the sequence. For example (no pun intended): >>> # Measure some strings: >>>...
- 7. Input and Output
...of your output than simply printing space-separated values. There are several ways to format output. To use formatted string literals, begin a string with f or F before the opening quotation mark or triple quotation mark. Inside this stri...
- Built-in Types
...types; in particular, practically all objects can be compared for equality, tested for truth value, and converted to a string (with the repr() function or the slightly different str() function). The latter function is implicitly used when...
- Design and History FAQ
...ng strange results with simple arithmetic operations? Why are floating-point calculations so inaccurate? Why are Python strings immutable? Why must ‘self’ be used explicitly in method definitions and calls? Why can’t I use an assignment in...
- Enum HOWTO
...me of the enumeration. The second argument is the source of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/value pairs, or a mapping (e.g. dictionary) of nam...
- Library and Extension FAQ
...gnal handlers work? Common tasks How do I test a Python program or component? How do I create documentation from doc strings? How do I get a single keypress at a time? Threads How do I program using threads? None of my threads seem to...
- Parsing arguments and building values
...hree of these functions described, PyArg_ParseTuple(), PyArg_ParseTupleAndKeywords(), and PyArg_Parse(), all use format strings which are used to tell the function about the expected arguments. The format strings use the same syntax for ea...
- Programming FAQ
...o write obfuscated one-liners in Python? What does the slash(/) in the parameter list of a function mean? Numbers and strings How do I specify hexadecimal and octal integers? Why does -22 // 10 return -3? How do I get int literal attribu...
- Regular Expression HOWTO
...hon and made available through the re module. Using this little language, you specify the rules for the set of possible strings that you want to match; this set might contain English sentences, or e-mail addresses, or TeX commands, or anyth...
- String conversion and formatting
String conversion and formatting Functions for number conversion and formatted string output. int PyOS_snprintf(char *str, size_t size, const char *format, ...) Part of the Stable ABI.Output not more than size bytes to s...
- Unicode HOWTO
...ussian. Web content can be written in any of these languages and can also include a variety of emoji symbols. Python’s string type uses the Unicode Standard for representing characters, which lets Python programs work with all these differ...
- Unicode Objects and Codecs
...to allow handling the complete range of Unicode characters while staying memory efficient. There are special cases for strings where all code points are below 128, 256, or 65536; otherwise, code points must be below 1114112 (which is the f...
- What’s New in Python 2.0
...low of bug fixes and improvements are always being submitted. A host of minor fixes, a few optimizations, additional docstrings, and better error messages went into 2.0; to list them all would be impossible, but they’re certainly significan...
- What’s New in Python 2.3
...s. A few new built-in functions have been added such as sum() and enumerate(). The in operator can now be used for substring searches (e.g. "ab" in "abc" returns True). Some of the many new library features include Boolean, set, heap, and...
- What’s New in Python 2.4
...ons, intersections, differences, and symmetric differences. >>> a = set('abracadabra') # form a set from a string >>> 'z' in a # fast membership testing False >>> a #...
- What’s New in Python 2.6
...P written by Jesse Noller and Richard Oudkerk; implemented by Richard Oudkerk and Jesse Noller. PEP 3101: Advanced String Formatting In Python 3.0, the % operator is supplemented by a more powerful string formatting method, format()....
- What’s New In Python 3.0
...ger a limit to the value of integers. However, sys.maxsize can be used as an integer larger than any practical list or string index. It conforms to the implementation’s “natural” integer size and is typically the same as sys.maxint in pre...
- What’s New In Python 3.11
...s PEP 655: Marking individual TypedDict items as required or not-required PEP 673: Self type PEP 675: Arbitrary literal string type PEP 681: Data class transforms Important deprecations, removals and restrictions: PEP 594: Many legacy sta...
- What’s New In Python 3.12
...en a number of improvements, and several modules have better performance. The language changes focus on usability, as f-strings have had many limitations removed and ‘Did you mean …’ suggestions continue to improve. The new type parameter s...
- What’s New In Python 3.3
...exception hierarchy. Implementation improvements: Rewritten import machinery based on importlib. More compact unicode strings. More compact attribute dictionaries. Significantly Improved Library Modules: C Accelerator for the decimal mo...
- What’s New In Python 3.6
...See also PEP 494 - Python 3.6 Release Schedule Summary – Release highlights New syntax features: PEP 498, formatted string literals. PEP 515, underscores in numeric literals. PEP 526, syntax for variable annotations. PEP 525, asynchrono...
- What’s New In Python 3.7
...piling code which executes expressions in annotations at their definition time, the compiler stores the annotation in a string form equivalent to the AST of the expression in question. If needed, annotations can be resolved at runtime using...
- What’s New In Python 3.8
...dled by the script); this change is backward incompatible on purpose. (Contributed by Victor Stinner in bpo-36721.) f-strings support = for self-documenting expressions and debugging Added an = specifier to f-strings. An f-string such as...
- What’s New In Python 3.9
...enerics in standard collections; PEP 614, relaxed grammar restrictions on decorators. New built-in features: PEP 616, string methods to remove prefixes and suffixes. New features in the standard library: PEP 593, flexible function and v...
- 2. Lexical analysis > f-strings
2.4.3. f-strings Added in version 3.6. A formatted string literal or f-string is a string literal that is prefixed with 'f' or 'F'. These strings may contain replacement fields, which are expressions delimited by curly braces {}. While...
- --without-doc-strings (program option, in 3. Configure Python)
- ast.get_docstring (Python function, in
ast
— Abstract Syntax Trees) - BUILD_STRING (opcode, in
dis
— Disassembler for Python bytecode) - collections.abc.ByteString (Python class, in
collections.abc
— Abstract Base Classes for Containers) - collections.UserString (Python class, in
collections
— Container datatypes) - configparser.ConfigParser.read_string (Python method, in
configparser
— Configuration file parser) - csv.QUOTE_STRINGS (Python data, in
csv
— CSV File Reading and Writing) - ctypes.create_string_buffer (Python function, in
ctypes
— A foreign function library for Python) - ctypes.string_at (Python function, in
ctypes
— A foreign function library for Python) - ctypes.wstring_at (Python function, in
ctypes
— A foreign function library for Python) - decimal.Context.to_eng_string (Python method, in
decimal
— Decimal fixed-point and floating-point arithmetic) - decimal.Context.to_sci_string (Python method, in
decimal
— Decimal fixed-point and floating-point arithmetic) - decimal.Decimal.to_eng_string (Python method, in
decimal
— Decimal fixed-point and floating-point arithmetic) - doctest.DocTest.docstring (Python attribute, in
doctest
— Test interactive Python examples) - doctest.run_docstring_examples (Python function, in
doctest
— Test interactive Python examples) - email.message.EmailMessage.as_string (Python method, in
email.message
: Representing an email message) - email.message.Message.as_string (Python method, in
email.message.Message
: Representing an email message using thecompat32
API) - email.message_from_string (Python function, in
email.parser
: Parsing email messages) - http.cookies.Morsel.OutputString (Python method, in
http.cookies
— HTTP state management) - http.server.BaseHTTPRequestHandler.address_string (Python method, in
http.server
— HTTP servers) - http.server.BaseHTTPRequestHandler.date_time_string (Python method, in
http.server
— HTTP servers) - http.server.BaseHTTPRequestHandler.log_date_time_string (Python method, in
http.server
— HTTP servers) - http.server.BaseHTTPRequestHandler.version_string (Python method, in
http.server
— HTTP servers) - io.StringIO (Python class, in
io
— Core tools for working with streams) - locale.format_string (Python function, in
locale
— Internationalization services) - mailbox.Mailbox.get_string (Python method, in
mailbox
— Manipulate mailboxes in various formats) - Py_CompileString (C function, in The Very High Level Layer)
- Py_CompileString.filename (C function parameter, in The Very High Level Layer)
- Py_CompileStringExFlags (C function, in The Very High Level Layer)
- Py_CompileStringExFlags.filename (C function parameter, in The Very High Level Layer)
- Py_CompileStringExFlags.flags (C function parameter, in The Very High Level Layer)
- Py_CompileStringFlags (C function, in The Very High Level Layer)
- Py_CompileStringFlags.filename (C function parameter, in The Very High Level Layer)
- Py_CompileStringFlags.flags (C function parameter, in The Very High Level Layer)
- Py_CompileStringObject (C function, in The Very High Level Layer)
- Py_CompileStringObject.filename (C function parameter, in The Very High Level Layer)
- Py_CompileStringObject.flags (C function parameter, in The Very High Level Layer)
- Py_STRINGIFY (C macro, in Introduction)
- PyByteArray_AS_STRING (C function, in Byte Array Objects)
- PyByteArray_AsString (C function, in Byte Array Objects)
- PyByteArray_FromStringAndSize (C function, in Byte Array Objects)
- PyBytes_AS_STRING (C function, in Bytes Objects)
- PyBytes_AsString (C function, in Bytes Objects)
- PyBytes_AsStringAndSize (C function, in Bytes Objects)
- PyBytes_AsStringAndSize.buffer (C function parameter, in Bytes Objects)
- PyBytes_FromString (C function, in Bytes Objects)
- PyBytes_FromStringAndSize (C function, in Bytes Objects)
- PyConfig_SetBytesString (C function, in Python Initialization Configuration)
- PyConfig_SetBytesString.config (C function parameter, in Python Initialization Configuration)
- PyConfig_SetBytesString.config_str (C function parameter, in Python Initialization Configuration)
- PyConfig_SetString (C function, in Python Initialization Configuration)
- PyConfig_SetString.config (C function parameter, in Python Initialization Configuration)
- PyConfig_SetString.config_str (C function parameter, in Python Initialization Configuration)
- PyConfig_SetWideStringList (C function, in Python Initialization Configuration)
- PyConfig_SetWideStringList.config (C function parameter, in Python Initialization Configuration)
- PyDict_ContainsString (C function, in Dictionary Objects)
- PyDict_DelItemString (C function, in Dictionary Objects)
- PyDict_GetItemString (C function, in Dictionary Objects)
- PyDict_GetItemStringRef (C function, in Dictionary Objects)
- PyDict_PopString (C function, in Dictionary Objects)
- PyDict_SetItemString (C function, in Dictionary Objects)
- PyErr_SetString (C function, in Exception Handling)
- PyFile_WriteString (C function, in File Objects)
- PyFloat_FromString (C function, in Floating-Point Objects)
- PyFrame_GetVarString (C function, in Frame Objects)
- PyFrame_GetVarString.frame (C function parameter, in Frame Objects)
- PyLong_FromString (C function, in Integer Objects)
- PyMapping_DelItemString (C function, in Mapping Protocol)
- PyMapping_GetItemString (C function, in Mapping Protocol)
- PyMapping_GetOptionalItemString (C function, in Mapping Protocol)
- PyMapping_HasKeyString (C function, in Mapping Protocol)
- PyMapping_HasKeyStringWithError (C function, in Mapping Protocol)
- PyMapping_SetItemString (C function, in Mapping Protocol)
- PyMarshal_ReadObjectFromString (C function, in Data marshalling support)
- PyMarshal_WriteObjectToString (C function, in Data marshalling support)
- PyModule_AddStringConstant (C function, in Module Objects)
- PyModule_SetDocString (C function, in Module Objects)
- PyModule_SetDocString.docstring (C function parameter, in Module Objects)
- PyObject_DelAttrString (C function, in Object Protocol)
- PyObject_DelItemString (C function, in Object Protocol)
- PyObject_GetAttrString (C function, in Object Protocol)
- PyObject_GetOptionalAttrString (C function, in Object Protocol)
- PyObject_HasAttrString (C function, in Object Protocol)
- PyObject_HasAttrStringWithError (C function, in Object Protocol)
- PyObject_SetAttrString (C function, in Object Protocol)
- PyOS_double_to_string (C function, in String conversion and formatting)
- PyOS_double_to_string.flags (C function parameter, in String conversion and formatting)
- PyOS_double_to_string.format_code (C function parameter, in String conversion and formatting)
- PyOS_snprintf (C function, in String conversion and formatting)
- PyOS_snprintf.format (C function parameter, in String conversion and formatting)
- PyOS_string_to_double (C function, in String conversion and formatting)
- PyOS_string_to_double.overflow_exception (C function parameter, in String conversion and formatting)
- PyOS_vsnprintf (C function, in String conversion and formatting)
- PyOS_vsnprintf.format (C function parameter, in String conversion and formatting)
- PyRun_SimpleString (C function, in The Very High Level Layer)
- PyRun_SimpleStringFlags (C function, in The Very High Level Layer)
- PyRun_SimpleStringFlags.flags (C function parameter, in The Very High Level Layer)
- PyRun_String (C function, in The Very High Level Layer)
- PyRun_StringFlags (C function, in The Very High Level Layer)
- PyRun_StringFlags.flags (C function parameter, in The Very High Level Layer)
- PyUnicode_AsASCIIString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsCharmapString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsEncodedString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsLatin1String (C function, in Unicode Objects and Codecs)
- PyUnicode_AsMBCSString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsRawUnicodeEscapeString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsUnicodeEscapeString (C function, in Unicode Objects and Codecs)
- PyUnicode_AsUTF16String (C function, in Unicode Objects and Codecs)
- PyUnicode_AsUTF32String (C function, in Unicode Objects and Codecs)
- PyUnicode_AsUTF8String (C function, in Unicode Objects and Codecs)
- PyUnicode_AsWideCharString (C function, in Unicode Objects and Codecs)
- PyUnicode_CompareWithASCIIString (C function, in Unicode Objects and Codecs)
- PyUnicode_FromString (C function, in Unicode Objects and Codecs)
- PyUnicode_FromStringAndSize (C function, in Unicode Objects and Codecs)
- PyUnicode_InternFromString (C function, in Unicode Objects and Codecs)
- PyUnicode_Substring (C function, in Unicode Objects and Codecs)
- PyWideStringList (C type, in Python Initialization Configuration)
- PyWideStringList_Append (C function, in Python Initialization Configuration)
- PyWideStringList_Insert (C function, in Python Initialization Configuration)
- quopri.decodestring (Python function, in
quopri
— Encode and decode MIME quoted-printable data) - quopri.encodestring (Python function, in
quopri
— Encode and decode MIME quoted-printable data) - reprlib.Repr.maxstring (Python attribute, in
reprlib
— Alternaterepr()
implementation) - string.Formatter (Python class, in
string
— Common string operations) - string.Formatter.convert_field (Python method, in
string
— Common string operations) - string.Formatter.format (Python method, in
string
— Common string operations) - string.Formatter.format_field (Python method, in
string
— Common string operations) - string.Formatter.get_field (Python method, in
string
— Common string operations) - string.Formatter.vformat (Python method, in
string
— Common string operations) - string.Template.get_identifiers (Python method, in
string
— Common string operations) - string.Template.safe_substitute (Python method, in
string
— Common string operations) - test.support.bytecode_helper.BytecodeTestCase.get_disassembly_as_string (Python method, in
test
— Regression tests package for Python) - test.support.HAVE_DOCSTRINGS (Python data, in
test
— Regression tests package for Python) - test.support.MISSING_C_DOCSTRINGS (Python data, in
test
— Regression tests package for Python) - test.support.requires_docstrings (Python function, in
test
— Regression tests package for Python) - tkinter.simpledialog.askstring (Python function, in Tkinter Dialogs)
- token.FSTRING_END (Python data, in
token
— Constants used with Python parse trees) - token.FSTRING_MIDDLE (Python data, in
token
— Constants used with Python parse trees) - token.FSTRING_START (Python data, in
token
— Constants used with Python parse trees) - turtle.write_docstringdict (Python function, in
turtle
— Turtle graphics) - typing.ByteString (Python class, in
typing
— Support for type hints) - typing.LiteralString (Python data, in
typing
— Support for type hints) - winreg.ExpandEnvironmentStrings (Python function, in
winreg
— Windows registry access) - xml.dom.DomstringSizeErr (Python exception, in
xml.dom
— The Document Object Model API) - xml.dom.minidom.parseString (Python function, in
xml.dom.minidom
— Minimal DOM implementation) - xml.dom.pulldom.parseString (Python function, in
xml.dom.pulldom
— Support for building partial DOM trees) - xml.etree.ElementTree.fromstring (Python function, in
xml.etree.ElementTree
— The ElementTree XML API) - xml.etree.ElementTree.fromstringlist (Python function, in
xml.etree.ElementTree
— The ElementTree XML API) - xml.etree.ElementTree.tostring (Python function, in
xml.etree.ElementTree
— The ElementTree XML API) - xml.etree.ElementTree.tostringlist (Python function, in
xml.etree.ElementTree
— The ElementTree XML API) - xml.parsers.expat.ErrorString (Python function, in
xml.parsers.expat
— Fast XML parsing using Expat) - xml.sax.handler.feature_string_interning (Python data, in
xml.sax.handler
— Base classes for SAX handlers) - xml.sax.handler.property_xml_string (Python data, in
xml.sax.handler
— Base classes for SAX handlers) - xml.sax.parseString (Python function, in
xml.sax
— Support for SAX2 parsers) - xmlrpc.client.Fault.faultString (Python attribute, in
xmlrpc.client
— XML-RPC client access) __future__
— Future statement definitions...RSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) _Feature.getOptionalRelease() OptionalRelease records the first releas...
__main__
— Top-level code environment...ent.futures.process' However, if the module is executed in the top-level code environment, its __name__ is set to the string '__main__'. What is the “top-level code environment”? __main__ is the name of the environment where top-level co...
abc
— Abstract Base Classesabc — Abstract Base Classes Source code: Lib/abc.py This module provides the infrastructure for defining abstract base classes (ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python. (See a...
argparse
— Parser for command-line options, arguments and subcommands...tion below, but in short they are: prog - The name of the program (default: os.path.basename(sys.argv[0])) usage - The string describing the program usage (default: generated from arguments added to parser) description - Text to display be...
array
— Efficient arrays of numeric values...l size can be accessed through the array.itemsize attribute. The module defines the following item: array.typecodes A string with all available type codes. The module defines the following type: class array.array(typecode[, initialize...
ast
— Abstract Syntax Trees...stract Grammar The abstract grammar is currently defined as follows: -- ASDL's 4 builtin types are: -- identifier, int, string, constant module Python { mod = Module(stmt* body, type_ignore* type_ignores) | Interactive(stmt* bo...
base64
— Base16, Base32, Base64, Base85 Data Encodings...s module. The modern interface supports encoding bytes-like objects to ASCII bytes, and decoding bytes-like objects or strings containing ASCII to bytes. Both base-64 alphabets defined in RFC 4648 (normal, and URL- and filesystem-safe) ar...
bdb
— Debugger framework...ne. enable() Mark the breakpoint as enabled. disable() Mark the breakpoint as disabled. bpformat() Return a string with all the information about the breakpoint, nicely formatted: Breakpoint number. Temporary status (del or kee...
binascii
— Convert between binary and ASCII...unctions written in C for greater speed that are used by the higher-level modules. Note a2b_* functions accept Unicode strings containing only ASCII characters. Other functions only accept bytes-like objects (such as bytes, bytearray and o...
bisect
— Array bisection algorithmbisect — Array bisection algorithm Source code: Lib/bisect.py This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. For long lists of items with expensiv...
builtins
— Built-in objectsbuiltins — Built-in objects This module provides direct access to all ‘built-in’ identifiers of Python; for example, builtins.open is the full name for the built-in function open(). This module is not normally accessed exp...
bz2
— Support for bzip2 compression...compress(data) Provide data to the compressor object. Returns a chunk of compressed data if possible, or an empty byte string otherwise. When you have finished providing data to the compressor, call the flush() method to finish the compres...
calendar
— General calendar-related functions...e plain text calendars. TextCalendar instances have the following methods: formatday(theday, weekday, width) Return a string representing a single day formatted with the given width. If theday is 0, return a string of spaces of the specif...
cmd
— Support for line-oriented command interpreters...patch to action methods, passing them the remainder of the line as argument. The optional argument is a banner or intro string to be issued before the first prompt (this overrides the intro class attribute). If the readline module is loaded...
code
— Interpreter base classes...ax error). This function almost always makes the same decision as the real interpreter main loop. source is the source string; filename is the optional filename from which source was read, defaulting to '<input>'; and symbol is the optiona...
codecs
— Codec registry and base classes...simplify and standardize error handling, codecs may implement different error handling schemes by accepting the errors string argument: >>> 'German ß, ♬'.encode(encoding='ascii', errors='backslashreplace') b'German \\xdf, \\u266c' >>> 'Ger...
codeop
— Compile Python code...ormer: codeop.compile_command(source, filename='<input>', symbol='single') Tries to compile source, which should be a string of Python code and return a code object if source is valid Python code. In that case, the filename attribute of...
collections
— Container datatypes...d dictionary objects for easier dict subclassing UserList wrapper around list objects for easier list subclassing UserString wrapper around string objects for easier string subclassing ChainMap objects Added in version 3.3. A ChainM...
compileall
— Byte-compile Python libraries...compileall — Byte-compile Python libraries Source code: Lib/compileall.py This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree. This...
concurrent.futures
— Launching parallel tasksconcurrent.futures — Launching parallel tasks Added in version 3.2. Source code: Lib/concurrent/futures/thread.py and Lib/concurrent/futures/process.py The concurrent.futures module provides a high-level interface for as...
configparser
— Configuration file parser...ted Datatypes Config parsers do not guess datatypes of values in configuration files, always storing them internally as strings. This means that if you need other datatypes, you should convert on your own: >>> int(topsecret['Port']) 50022...
contextlib
— Utilities forwith
-statement contexts...ing An example using enter_result: def process_file(file_or_path): if isinstance(file_or_path, str): # If string, open file cm = open(file_or_path) else: # Caller is responsible for closing file cm...
contextvars
— Context Variables...cess context-local state. The ContextVar class is used to declare and work with Context Variables. The copy_context() function and the Context class should be used to manage the current context in asynchronous frameworks. Context managers...
copyreg
— Registerpickle
support functions...eclares that function should be used as a “reduction” function for objects of type type. function must return either a string or a tuple containing between two and six elements. See the dispatch_table for more details on the interface of f...
csv
— CSV File Reading and Writing..., **fmtparams) Return a reader object that will process lines from the given csvfile. A csvfile must be an iterable of strings, each in the reader’s defined csv format. A csvfile is most commonly a file-like object or list. If csvfile is a...
ctypes
— A foreign function library for Python...cess the version you need by specifying GetModuleHandleA or GetModuleHandleW explicitly, and then call it with bytes or string objects respectively. Sometimes, dlls export functions with names which aren’t valid Python identifiers, like "??...
curses.ascii
— Utilities for ASCII characters...f or 0x7f). curses.ascii.isdigit(c) Checks for an ASCII decimal digit, '0' through '9'. This is equivalent to c in string.digits. curses.ascii.isgraph(c) Checks for ASCII any printable character except space. curses.ascii.islow...
curses
— Terminal handling for character-cell displays...orms. Note Whenever the documentation mentions a character it can be specified as an integer, a one-character Unicode string or a one-byte byte string. Whenever the documentation mentions a character string it can be specified as a Unicod...
dataclasses
— Data Classes...(), this parameter is ignored. repr: If true (the default), a __repr__() method will be generated. The generated repr string will have the class name and the name and repr of each field, in the order they are defined in the class. Fields...
datetime
— Basic date and time types...ds), and to t1 * -1. (1)(4) abs(t) Equivalent to +t when t.days >= 0, and to -t when t.days < 0. (2) str(t) Returns a string in the form [D day[s], ][H]H:MM:SS[.UUUUUU], where D is negative for negative t. (5) repr(t) Returns a string re...
dbm
— Interfaces to Unix “databases”...eturn one of the following values: None if the file can’t be opened because it’s unreadable or doesn’t exist the empty string ('') if the file’s format can’t be guessed a string containing the required module name, such as 'dbm.ndbm' or 'd...
decimal
— Decimal fixed-point and floating-point arithmetic...peration]) >>> getcontext().prec = 7 # Set a new precision Decimal instances can be constructed from integers, strings, floats, or tuples. Construction from an integer or a float performs an exact conversion of the value of that in...
difflib
— Helpers for computing deltas...olines, fromdesc='', todesc='', context=False, numlines=5, *, charset='utf-8') Compares fromlines and tolines (lists of strings) and returns a string which is a complete HTML file containing a table showing line by line differences with int...
dis
— Disassembler for Python bytecode..._offsets=False) Analyse the bytecode corresponding to a function, generator, asynchronous generator, coroutine, method, string of source code, or a code object (as returned by compile()). This is a convenience wrapper around many of the fun...
doctest
— Test interactive Python examples...to verify that they work exactly as shown. There are several common ways to use doctest: To check that a module’s docstrings are up-to-date by verifying that all interactive examples still work as documented. To perform regression testin...
email.charset
: Representing character sets...ollowing methods: get_body_encoding() Return the content transfer encoding used for body encoding. This is either the string quoted-printable or base64 depending on the encoding used, or it is a function, in which case you should call the...
email.contentmanager
: Managing MIME Content...tracted data. To find the handler, look for the following keys in the registry, stopping with the first one found: the string representing the full MIME type (maintype/subtype) the string representing the maintype the empty string If none...
email.generator
: Generating MIME documents...y data. If optional mangle_from_ is True, put a > character in front of any line in the body that starts with the exact string "From ", that is From followed by a space at the beginning of a line. mangle_from_ defaults to the value of the...
email.header
: Internationalized headers...you should use the Header class and assign the field in the Message object to an instance of Header instead of using a string for the header value. Import the Header class from the email.header module. For example: >>> from email.message...
email.headerregistry
: Custom Header Objects...email.headerregistry.BaseHeader(name, value) name and value are passed to BaseHeader from the header_factory call. The string value of any header object is the value fully decoded to unicode. This base class defines the following read-only...
email.iterators
: Iterators...ors.body_line_iterator(msg, decode=False) This iterates over all the payloads in all the subparts of msg, returning the string payloads line-by-line. It skips over all the subpart headers, and it skips over any subpart with a payload that...
email.message.Message
: Representing an email message using thecompat32
API...Message pseudo-dictionary is indexed by the header names, which must be ASCII values. The values of the dictionary are strings that are supposed to contain only ASCII characters; there is some special handling for non-ASCII input, but it d...
email.message
: Representing an email message...dictionary-like interface is indexed by the header names, which must be ASCII values. The values of the dictionary are strings with some extra methods. Headers are stored and returned in case-preserving form, but field names are matched c...
email.mime
: Creating email and MIME objects from scratch...be added to the message object. A MIME-Version header will also be added. Optional boundary is the multipart boundary string. When None (the default), the boundary is calculated when needed (for example, when the message is serialized)....
email.parser
: Parsing email messages...ard parser that understands most email document structures, including MIME documents. You can pass the parser a bytes, string or file object, and the parser will return to you the root EmailMessage instance of the object structure. For si...
email.policy
: Policy Objectsemail.utils
: Miscellaneous utilitiesemail
: Examplesensurepip
— Bootstrapping thepip
installer