string — Common string operations — Python 3.15.2 documentation
Source code: Lib/string/__init__.py String constants: The constants defined in this module are: Custom string formatting: The built-in string class provides ...
Source code: Lib/string/__init__.py String constants: The constants defined in this module are: Custom string formatting: The built-in string class provides ...
2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code.It is also located in the Tools/scripts directory of the Python root. 2to3’s basic arguments are a list of files or directories to transform.
That short script executes and verifies any interactive Python examples contained in the file example.txt. The file content is treated as if it were a single giant docstring; the file doesn’t need to contain a Python program! For example, perhaps example.txt contains this
So far weve encountered two ways of writing values: expression statements and the print() function. (A third way is using the write() method of file objects; the standard output file can be referenced as sys.stdout. See the Library Reference for more information on this.)
A format string consists of zero or more “format units.” A format unit describes one Python object; it is usually a single character or a parenthesized sequence ...
This example program is a fairly realistic example of a simple program.The xml.dom.minidom module is essentially a DOM 1.0-compatible DOM with some DOM 2 features (primarily namespace features). Usage of the DOM interface in Python is straight-forward.
15 hours ago · Read and parse configuration data from f which must be an iterable yielding Unicode strings (for example files opened in text mode). Optional argument source specifies the name of the file being read.
Source code: Lib/urllib/parse.py. This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, path etc.), to combine the components back into a URL string...
1 day ago · The library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming.
This tutorial is intended to be a gentle introduction to argparse, the recommended command-line parsing module in the Python standard library.
Return a JSON string representation of a Python data structure, o. For exampleSource code: Lib/json/tool.py. The json module can be invoked as a script via python -m json to validate and pretty-print JSON objects. The json.tool submodule implements this interface.
15 hours ago · The BytesFeedParser can of course be used to parse an email message fully contained in a bytes-like object, string, or file, but the BytesParser API may be more convenient for such use cases. The semantics and results of the two parser APIs are identical.
15 hours ago · Source code: Lib/html/parser.py This module defines a class HTMLParser which serves as the basis for parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML. Example HTML Parser...
Source code: Lib/re/ This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched ...