Biblioteka standardowa Pythona¶
W odróżnieniu od dokumentacji języka Python, która opisuje dokładną składnię i semantykę języka Python, ta dokumentacja opisuje bibliotekę standardową, która jest rozpowszechniana z Pythonem. Opisuje również niektóre opcjonalne komponenty, które często są zawarte w dystrybucjach Pythona.
Biblioteka standardowa Pythona jest bardzo obszerna i oferuje szeroki wachlarz narzędzi, co widać w długości spisu treści poniżej. Biblioteka zawiera wbudowane moduły (napisane w C), które dają dostęp do funkcjonalności systemowych, takich jak pliki wejścia/wyjścia, które w przeciwnym przypadku byłyby niedostępne dla programistów Pythona. Zawiera również moduły napisane w Pythonie, które dostarczają ustandaryzowane rozwiązania wielu problemów, które napotyka się podczas programowania na co dzień. Niektóre z tych modułów są bezpośrednio zaprojektowane tak, by zachęcać i zwiększać przenośność programów napisanych w Pythonie przez dodawanie abstrakcji nad specyfikami platform i tworzenie API neutralnych platformowo.
Instalatory Python dla platformy Windows zazwyczaj zawierają całą bibliotekę standardową, a często także wiele dodatkowych komponentów. W przypadku systemów operacyjnych podobnych do Unix Python jest zwykle dostarczany jako zbiór pakietów, więc może być konieczne użycie narzędzi do pakowania dostarczonych z systemem operacyjnym w celu uzyskania niektórych lub wszystkich składników opcjonalnych.
Oprócz biblioteki standardowej, istnieje aktywna kolekcja setek tysięcy komponentów (od pojedynczych programów i moduł do pakietów i całych programistycznych aplikacji ), dostępnych w Python Pakiet indeks .
- Wprowadzenie
- Wbudowane funkcje
- Wbudowane stałe
- Wbudowane typy
- Truth Value Testing
- Boolean Operations —
and
,or
,not
- Comparisons
- Numeric Types —
int
,float
,complex
- Boolean Type -
bool
- Iterator Types
- Sequence Types —
list
,tuple
,range
- Тип текстової послідовності —
str
- Типи бінарних послідовностей —
bytes
,bytearray
,memoryview
- Типи наборів —
set
,frozenset
- Типи зіставлення —
dict
- Bağlam Yöneticisi Türleri
- Типи анотацій типу — Загальний псевдонім, Об’єднання
- Інші вбудовані типи
- Atribut Spesial
- Ограничение длины преобразования целочисленной строки
- Built-in Exceptions
- Usługi przetwarzania tekstu
string
— Общие операции со строкамиre
— Операции с регулярными выражениямиdifflib
— Helpers for computing deltastextwrap
— Text wrapping and fillingunicodedata
— Unicode Databasestringprep
— Internet String Preparationreadline
— GNU readline interfacerlcompleter
— Completion function for GNU readline
- Binary Data Services
- Typy danych
datetime
— Basic date and time typeszoneinfo
— IANA time zone supportcalendar
— General calendar-related functionscollections
— Container datatypescollections.abc
— Abstract Base Classes for Containersheapq
— Heap queue algorithmbisect
— Array bisection algorithmarray
— Efficient arrays of numeric valuesweakref
— Слабкі посиланняtypes
— Dynamic type creation and names for built-in typescopy
— Shallow and deep copy operationspprint
— Принтер данныхreprlib
— Alternaterepr()
implementationenum
— Support for enumerationsgraphlib
— Functionality to operate with graph-like structures
- Numeric and Mathematical Modules
numbers
— Numeric abstract base classes- Сообщайте о событиях, которые происходят во время нормальной работы программы (например, для мониторинга состояния или расследования ошибок).
cmath
— Mathematical functions for complex numbersdecimal
— Decimal fixed-point and floating-point arithmeticfractions
— Rational numbersrandom
— Генерация псевдослучайных чиселstatistics
— Функции математической статистики
- Functional Programming Modules
- File and Directory Access
pathlib
— Object-oriented filesystem pathsos.path
— Common pathname manipulationsstat
— Interpretingstat()
resultsfilecmp
— File and Directory Comparisonstempfile
— Generate temporary files and directoriesglob
— Unix style pathname pattern expansionfnmatch
— Unix filename pattern matchinglinecache
— Random access to text linesshutil
— Высокоуровневые файловые операции
- Data Persistence
pickle
— Сериализация объектов Pythoncopyreg
— Registerpickle
support functionsshelve
— Сохранение объектов Pythonmarshal
— Internal Python object serializationdbm
— Interfaces to Unix „databases”- Некоторые символы, такие как
'|'
или'('
, являются специальными. Специальные символы либо обозначают классы обычных символов, либо влияют на интерпретацию регулярных выражений вокруг них.
- Data Compression and Archiving
- File Formats
- Cryptographic Services
- Generic Operating System Services
os
— Miscellaneous operating system interfacesio
— Core tools for working with streamstime
— Доступ ко времени и преобразованияlogging
— Возможность ведения журналов для Pythonlogging.config
— Конфигурация журналированияlogging.handlers
— Обработчики журналированияplatform
— Доступ к идентификационным данным базовой платформы.errno
— Standard errno system symbolsctypes
— A foreign function library for Python
- Command-line interface libraries
argparse
— Parser for command-line options, arguments and subcommandsoptparse
— Анализатор параметров командной строкиgetpass
— Portable password inputfileinput
— Iterate over lines from multiple input streamscurses
— Terminal handling for character-cell displayscurses.textpad
— Text input widget for curses programscurses.ascii
— Utilities for ASCII characterscurses.panel
— A panel stack extension for cursescmd
— Support for line-oriented command interpreters
- Concurrent Execution
threading
— Thread-based parallelism- Первое упоминание о совместном
multiprocessing.shared_memory
— Общая память для прямого доступа между процессами- The
concurrent
package concurrent.futures
— Launching parallel taskssubprocess
— Subprocess managementsched
— Планировщик событийqueue
— A synchronized queue classcontextvars
— Context Variables_thread
— Low-level threading API
- Networking and Interprocess Communication
- Internet Data Handling
email
— An email and MIME handling packagejson
— JSON encoder and decodermailbox
— Управление почтовыми ящиками в различных форматах.mimetypes
— Map filenames to MIME typesbase64
— Base16, Base32, Base64, Base85 Data Encodingsbinascii
— Convert between binary and ASCIIquopri
— Encode and decode MIME quoted-printable data
- Structured Markup Processing Tools
html
— HyperText Markup Language supporthtml.parser
— Simple HTML and XHTML parserhtml.entities
— Definitions of HTML general entities- XML Processing Modules
xml.etree.ElementTree
— The ElementTree XML APIxml.dom
— The Document Object Model APIxml.dom.minidom
— Минимальная реализация DOMxml.dom.pulldom
— Support for building partial DOM treesxml.sax
— Support for SAX2 parsersxml.sax.handler
— Base classes for SAX handlersxml.sax.saxutils
— SAX Utilitiesxml.sax.xmlreader
— Interface for XML parsersxml.parsers.expat
— Fast XML parsing using Expat
- Internet Protocols and Support
webbrowser
— Удобный контроллер веб-браузераwsgiref
— Утилиты WSGI и эталонная реализацияurllib
— URL handling modulesurllib.request
— Extensible library for opening URLsurllib.response
— Response classes used by urlliburllib.parse
— Parse URLs into componentsurllib.error
— Exception classes raised by urllib.requesturllib.robotparser
— Parser for robots.txthttp
— HTTP moduleshttp.client
— HTTP protocol clientftplib
— FTP protocol clientpoplib
— Клиент протокола POP3imaplib
— IMAP4 protocol clientsmtplib
— SMTP protocol clientuuid
— UUID objects according to RFC 4122socketserver
— Фреймворк для сетевых серверов.http.server
— HTTP servershttp.cookies
— HTTP state managementhttp.cookiejar
— Cookie handling for HTTP clientsxmlrpc
— Серверные и клиентские модули XMLRPCxmlrpc.client
— XML-RPC client accessxmlrpc.server
— Basic XML-RPC serversipaddress
— IPv4/IPv6 manipulation library
- Multimedia Services
- Internationalization
- Graphical user interfaces with Tk
tkinter
— Python interface to Tcl/Tktkinter.colorchooser
— Color choosing dialogtkinter.font
— Tkinter font wrapper- Tkinter Dialogs
tkinter.messagebox
— Tkinter message promptstkinter.scrolledtext
— Scrolled Text Widgettkinter.dnd
— Drag and drop supporttkinter.ttk
— Tk themed widgets- IDLE — Python edytor i powłoka
turtle
— Turtle graphics
- Development Tools
typing
— Support for type hintspydoc
— Генератор документации и онлайн-справочная система.- Python Development Mode
doctest
— Test interactive Python examplesunittest
— Framework testów jednostkowychunittest.mock
— mock object libraryunittest.mock
— getting startedtest
— Regression tests package for Pythontest.support
— Utilities for the Python test suitetest.support.socket_helper
— Utilities for socket teststest.support.script_helper
— Utilities for the Python execution teststest.support.bytecode_helper
— Support tools for testing correct bytecode generationtest.support.threading_helper
— Utilities for threading teststest.support.os_helper
— Utilities for os teststest.support.import_helper
— Utilities for import teststest.support.warnings_helper
— Utilities for warnings tests
- Debugowanie i profilowanie
- Software Packaging and Distribution
- Python Runtime Services
sys
— System-specific parameters and functionssys.monitoring
— Мониторинг событий выполненияsysconfig
— Provide access to Python’s configuration informationbuiltins
— Built-in objects__main__
— Top-level code environmentwarnings
— Warning controldataclasses
— Data Classescontextlib
— Utilities forwith
-statement contextsabc
— Abstract Base Classesatexit
— Exit handlerstraceback
— Print or retrieve a stack traceback__future__
— Future statement definitionsgc
— Garbage Collector interfaceinspect
— Inspect live objectssite
— Site-specific configuration hook
- Custom Python Interpreters
- Mengimpor Modul
zipimport
— Import modules from Zip archivespkgutil
— Утилита расширения пакетаmodulefinder
— Find modules used by a scriptrunpy
— Поиск и выполнение модулей Pythonimportlib
— The implementation ofimport
importlib.resources
– Package resource reading, opening and accessimportlib.resources.abc
– Abstract base classes for resourcesimportlib.metadata
– Accessing package metadata- The initialization of the
sys.path
module search path
- Python Language Services
ast
— Abstract Syntax Treessymtable
— Access to the compiler’s symbol tablestoken
— Constants used with Python parse treeskeyword
— Testing for Python keywordstokenize
— Tokenizer for Python sourcetabnanny
— Detection of ambiguous indentationpyclbr
— Python module browser supportpy_compile
— Компилировать исходные файлы Pythoncompileall
— Byte-compile Python librariesdis
— Disassembler for Python bytecodepickletools
— Tools for pickle developers
- MS Windows Specific Services
- Unix-specific services
shlex
— Simple lexical analysisposix
— The most common POSIX system callspwd
— База данных паролейgrp
— The group databasetermios
— POSIX style tty controltty
— Terminal control functionspty
— Утилиты псевдотерминалаfcntl
— Thefcntl
andioctl
system callsresource
— Информация об использовании ресурсаsyslog
— Подпрограммы библиотеки системного журнала Unix
- Modules command-line interface (CLI)
- Superseded Modules
- Removed Modules
- Güvenlik Hususları