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.
The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. For Unix-like operating systems Python is normally provided as a collection of packages, so it may be necessary to use the packaging tools provided with the operating system to obtain some or all of the optional components.
In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from the Python Package Index.
- Wprowadzenie
- Funkcje wbudowane
- Built-in Constants
- Typy wbudowane
- Truth Value Testing
- Boolean Operations —
and
,or
,not
- Comparisons
- Numeric Types —
int
,float
,complex
- Iterator Types
- Sequence Types —
list
,tuple
,range
- Text Sequence Type —
str
- Binary Sequence Types —
bytes
,bytearray
,memoryview
- Set Types —
set
,frozenset
- Mapping Types —
dict
- Context Manager Types
- Type Annotation Types — Generic Alias, Union
- Other Built-in Types
- Special Attributes
- Integer string conversion length limitation
- Built-in Exceptions
- Usługi przetwarzania tekstu
string
— Common string operationsre
— Regular expression operationsdifflib
— 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
— algorytm bisekcji tablicyarray
— Efektywne tablice wartości numerycznychweakref
— Weak referencestypes
— Dynamic type creation and names for built-in typescopy
— Shallow and deep copy operationspprint
— Data pretty printerreprlib
— Alternaterepr()
implementationenum
— Wsparcie dla wyliczeńgraphlib
— Functionality to operate with graph-like structures
- Numeric and Mathematical Modules
- Functional Programming Modules
- File and Directory Access
pathlib
— Object-oriented filesystem pathsos.path
— Common pathname manipulationsfileinput
— Iterate over lines from multiple input streamsstat
— 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
— High-level file operations
- Data Persistence
- Data Compression and Archiving
- File Formats
- Cryptographic Services
- Generic Operating System Services
os
— Miscellaneous operating system interfacesio
— Core tools for working with streamstime
— Time access and conversionsargparse
— Parser for command-line options, arguments and sub-commandsgetopt
— C-style parser for command line optionslogging
— Logging facility for Pythonlogging.config
— Logging configurationlogging.handlers
— Logging handlersgetpass
— Portable password inputcurses
— Terminal handling for character-cell displayscurses.textpad
— Text input widget for curses programscurses.ascii
— Utilities for ASCII characterscurses.panel
— A panel stack extension for cursesplatform
— Access to underlying platform’s identifying dataerrno
— Standard errno system symbolsctypes
— A foreign function library for Python
- Concurrent Execution
threading
— Thread-based parallelismmultiprocessing
— Process-based parallelismmultiprocessing.shared_memory
— Shared memory for direct access across processes- The
concurrent
package concurrent.futures
— Launching parallel taskssubprocess
— Subprocess managementsched
— Event schedulerqueue
— 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
— Manipulate mailboxes in various formatsmimetypes
— Map filenames to MIME typesbase64
— Base16, Base32, Base64, Base85 Data Encodingsbinhex
— Koduj i dekoduj pliki binhex4binascii
— 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
— Minimal DOM implementationxml.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
— Convenient web-browser controllerwsgiref
— WSGI Utilities and Reference Implementationurllib
— 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
— POP3 protocol clientimaplib
— IMAP4 protocol clientsmtplib
— SMTP protocol clientuuid
— UUID objects according to RFC 4122socketserver
— A framework for network servershttp.server
— HTTP servershttp.cookies
— HTTP state managementhttp.cookiejar
— Cookie handling for HTTP clientsxmlrpc
— XMLRPC server and client modulesxmlrpc.client
— XML-RPC client accessxmlrpc.server
— Basic XML-RPC serversipaddress
— IPv4/IPv6 manipulation library
- Multimedia Services
- Internationalization
- Program Frameworks
- 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 widgetstkinter.tix
— Extension widgets for Tk- IDLE
- Development Tools
typing
— Support for type hintspydoc
— Documentation generator and online help system- Python Development Mode
- Effects of the Python Development Mode
- ResourceWarning Example
- Bad file descriptor error example
doctest
— Test interactive Python examplesunittest
— Unit testing frameworkunittest.mock
— mock object libraryunittest.mock
— getting started- 2to3 — Automated Python 2 to 3 code translation
test
— 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 functionssysconfig
— Provide access to Python’s configuration informationbuiltins
— Built-in objects__main__
— Top-level code environmentwarnings
— Warning controldataclasses
— Data Classescontextlib
— Utilities forwith
-statement contextsabc
— abstrakcyjne klasy bazoweatexit
— 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
- Importing Modules
- 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
— Compile Python source filescompileall
— Byte-compile Python librariesdis
— Disassembler for Python bytecodepickletools
— Tools for pickle developers
- MS Windows Specific Services
- Unix Specific Services
posix
— The most common POSIX system callspwd
— The password databasegrp
— The group databasetermios
— POSIX style tty controltty
— Terminal control functionspty
— Pseudo-terminal utilitiesfcntl
— Thefcntl
andioctl
system callsresource
— Resource usage informationsyslog
— Unix syslog library routines
- Superseded Modules
aifc
— Read and write AIFF and AIFC filesasynchat
— Asynchroniczna obsługa gniazda komend/odpowiedzi.- Moduł
asyncore
— Asynchroniczna obsługa gniazda audioop
— Manipulate raw audio datacgi
— wsparcie dla wspólnego sprzęgu bramki - z ang. - Common Gateway Interfacecgitb
— Traceback manager for CGI scriptschunk
— Wczytaj pokawałkowane dane IFFcrypt
— Function to check Unix passwordsimghdr
— Determine the type of an imageimp
— Access the import internalsmailcap
— Mailcap file handlingmsilib
— Read and write Microsoft Installer filesnis
— Interface to Sun’s NIS (Yellow Pages)nntplib
— NNTP protocol clientoptparse
— Parser for command line optionsossaudiodev
— Access to OSS-compatible audio devicespipes
— Interface to shell pipelinessmtpd
— SMTP Serversndhdr
— Determine type of sound filespwd
— The shadow password databasesunau
— Read and write Sun AU filestelnetlib
— Telnet clientuu
— Encode and decode uuencode filesxdrlib
— Encode and decode XDR data
- Security Considerations