Built-in functions — Python 3.15.2 documentation
Return the string representing a character with the specified Unicode code point. For example, chr(97) returns the string 'a' , while chr(8364) ...
Return the string representing a character with the specified Unicode code point. For example, chr(97) returns the string 'a' , while chr(8364) ...
| string — Common string operations¶. Source code: Lib/string/__init__.py. See also. Text Sequence Type — str.As an example of a library built on template strings for i18n, see the flufl.i18n package. Template strings support $-based substitutions, using the following rules
In the following examples, input and output are distinguished by the presence or absence of prompts (>>> and …): to repeat the example, you must type ...
This is the official documentation for Python 3.15.2.Python's C API C API reference. FAQs Frequently asked questions (with answers!) Deprecations Deprecated functionality.
The environment where top-level code is run. Covers command-line interfaces, import-time behavior, and ``__name__ == '__main__'``. _thread ...
Simple example: A descriptor that returns a constant. Dynamic lookups. Managed attributes. Customized names. Closing thoughts. Complete Practical Example. Validator class.
1 day ago · For example, here’s a case-insensitive string comparison using str.casefold (): ... The value of the key parameter should be a function (or other callable) that takes a single argument and returns a key to use for sorting purposes. This technique is fast because the key function is called exactly once for each input record.
Symbols · comment, [1], [2] · in doctests · in printf-style formatting, [1] · in regular expressions · in string formatting · source encoding declaration.
It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well. For a description of standard objects and modules, see Python built-ins reference and The Python standard library.
1 day ago · The str.format () method of strings requires more manual effort. You’ll still use { and } to mark where a variable will be substituted and can provide detailed formatting directives, but you’ll also need to provide the information to be formatted. In the following code block there are two examples of how to format variables:
The deferred loading reduces startup latency without requiring code restructuring or conditional imports scattered throughout the codebase. In the case where ...
Source code: Lib/csv.py. The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in RFC 4180.
1 day ago · Text Processing Services ¶ The modules described in this chapter provide a wide range of string manipulation operations and other text processing services. The codecs module described under Binary Data Services is also highly relevant to text processing. In addition, see the documentation for Python’s built-in string type in Text Sequence Type — str.
Source code: Lib/socket.py This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably ...
1 day ago · Regular expression HOWTO ¶ Abstract This document is an introductory tutorial to using regular expressions in Python with the re module. It provides a gentler introduction than the corresponding section in the Library Reference. Introduction ¶ Regular expressions (called REs, or regexes, or regex patterns) are essentially a tiny, highly specialized programming language embedded inside Python ...
This is a string with four space-delimited elements, each of which is a legal distance (see above), or a sequence of four such elements. For example: "2 3 4 5" ...