The Python standard library — Python 3.15.2 documentation
Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform- ...
Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform- ...
Return the string representing a character with the specified Unicode code point. For example, chr(97) returns the string 'a' , while chr(8364) ...
Since Python’s floats are stored internally as binary numbers, converting a float to or from a decimal string usually involves a small rounding error. In contrast, hexadecimal strings allow exact representation and specification of floating-point numbers.
1 day ago · 5. Data Structures ¶ This chapter describes some things you’ve learned about already in more detail, and adds some new things as well. 5.1. More on Lists ¶ The list data type has some more methods. Here are all of the methods of list objects: list.append(value, /) Add an item to the end of the list. Similar to a [len (a):] = [x]. list.extend(iterable, /) Extend the list by appending all ...
1 day ago · The Python Tutorial ¶ Tip This tutorial is designed for programmers that are new to the Python language, not beginners who are new to programming. Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming.
Source code: Lib/string/__init__.py String constants: The constants defined in this module are: Custom string formatting: The built-in string class provides ...
1 day ago · The array module provides an array object that is like a list that stores only homogeneous data and stores it more compactly. The following example shows an array of numbers stored as two byte unsigned binary numbers (typecode "H") rather than the usual 16 bytes per entry for regular lists of Python int objects:
that it returns a list of strings instead of one big string with newlines to separate the wrapped lines. The locale module accesses a database of culture specific data formats. The grouping attribute of locale’s format function provides a direct way of formatting numbers with group separators
1 day ago · 3. An Informal Introduction to Python ¶ In the following examples, input and output are distinguished by the presence or absence of prompts (>>> and …): to repeat the example, you must type everything after the prompt, when the prompt appears; lines that do not begin with a prompt are output from the interpreter.
The environment where top-level code is run. Covers command-line interfaces, import-time behavior, and ``__name__ == '__main__'``. _thread ...
1 day ago · The initializer is omitted if the array is empty, otherwise it is a Unicode string if the typecode is 'u' or 'w', otherwise it is a list of numbers. The string representation is guaranteed to be able to be converted back to an array with the same type and value using eval (), so long as the array class has been imported using from array import ...
Source code: Lib/tkinter/__init__.py The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit. Both Tk and tkinter ...
1 day ago · The string type has some methods that perform useful operations for padding strings to a given column width. When you don’t need fancy output but just want a quick display of some variables for debugging purposes, you can convert any value to a string with the repr () or str () functions.
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.