La bibliothèque standard¶
Alors que La référence du langage Python décrit exactement la syntaxe et la sémantique du langage Python, ce manuel de référence de la Bibliothèque décrit la bibliothèque standard distribuée avec Python. Il décrit aussi certains composants optionnels typiquement inclus dans les distributions de Python.
La bibliothèque standard de Python est très grande, elle offre un large éventail d'outils comme le montre la longueur de la table des matières ci-dessous. La bibliothèque contient des modules natifs (écrits en C) exposant les fonctionnalités du système telles que les interactions avec les fichiers qui autrement ne seraient pas accessibles aux développeurs Python, ainsi que des modules écrits en Python exposant des solutions standardisées à de nombreux problèmes du quotidien du développeur. Certains de ces modules sont définis explicitement pour encourager et améliorer la portabilité des programmes Python en abstrayant des spécificités sous-jacentes en API neutres.
Les installateurs de Python pour Windows incluent généralement la bibliothèque standard en entier, et y ajoutent souvent d'autres composants. Pour les systèmes d'exploitation Unix, Python est typiquement fourni sous forme d'une collection de paquets, il peut donc être nécessaire d'utiliser le gestionnaire de paquets fourni par le système d'exploitation pour obtenir certains composants optionnels.
Au delà de la bibliothèque standard, il existe une collection grandissante de plusieurs centaine de milliers de composants (des programmes, des modules, ou des frameworks), disponibles dans le Python Package Index.
- Introduction
- Fonctions natives
abs()
aiter()
all()
anext()
any()
ascii()
bin()
bool
breakpoint()
callable()
chr()
classmethod()
compile()
complex
delattr()
dir()
divmod()
enumerate()
eval()
exec()
filter()
float
format()
getattr()
globals()
hasattr()
hash()
help()
hex()
id()
input()
int
isinstance()
issubclass()
iter()
len()
locals()
map()
max()
min()
next()
object
oct()
open()
ord()
pow()
print()
property
repr()
reversed()
round()
setattr()
slice
sorted()
staticmethod()
sum()
super
type
vars()
zip()
__import__()
- Constantes natives
- Types natifs
- Valeurs booléennes
- Opérations booléennes —
and
,or
,not
- Comparaisons
- Types numériques —
int
,float
,complex
- Boolean Type -
bool
- Les types itérateurs
- Types séquentiels —
list
,tuple
,range
- Type Séquence de Texte —
str
- Séquences Binaires —
bytes
,bytearray
,vue mémoire
- Types d'ensembles —
set
,frozenset
- Les types de correspondances —
dict
- Le type gestionnaire de contexte
- Types d'annotation de type — Alias générique, Union
- Autres types natifs
- Attributs spéciaux
- Limitation de longueur de conversion de chaîne vers un entier
- Exceptions natives
- Services de Manipulation de Texte
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
- Services autour des Données Binaires
- Types de données
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
--- Weak referencestypes
--- Dynamic type creation and names for built-in typescopy
--- Shallow and deep copy operationspprint
--- Data pretty printerreprlib
--- Alternaterepr()
implementationenum
--- Support for enumerationsgraphlib
--- Functionality to operate with graph-like structures
- Modules numériques et mathématiques
numbers
--- Numeric abstract base classesmath
--- Mathematical functionscmath
--- Mathematical functions for complex numbersdecimal
--- Decimal fixed-point and floating-point arithmeticfractions
--- Rational numbersrandom
--- Generate pseudo-random numbersstatistics
--- Mathematical statistics functions
- Modules de programmation fonctionnelle
- Accès aux Fichiers et aux Dossiers
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
- Persistance des données
- Compression de donnée et archivage
- Formats de fichiers
- Service de cryptographie
- Services génériques du système d'exploitation
os
--- Miscellaneous operating system interfacesio
--- Core tools for working with streamstime
--- Time access and conversionsargparse
--- Parser for command-line options, arguments and subcommandslogging
--- 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
- Exécution concourante
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
- Réseau et communication entre processus
- Traitement des données provenant d'Internet
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 Encodingsbinascii
--- Convert between binary and ASCIIquopri
--- Encode and decode MIME quoted-printable data
- Outils de traitement de balises structurées
html
--- HyperText Markup Language supporthtml.parser
--- Simple HTML and XHTML parserhtml.entities
--- Definitions of HTML general entities- Modules de traitement XML
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
- Gestion des protocoles internet
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
- Services multimédia
- Internationalisation
- Cadriciels d'applications
- Interfaces Utilisateur Graphiques avec Tk
tkinter
--- Python interface to Tcl/Tktkinter.colorchooser
--- Color choosing dialogtkinter.font
--- Tkinter font wrapper- Boîtes de dialogue Tkinter
tkinter.messagebox
--- Tkinter message promptstkinter.scrolledtext
--- Scrolled Text Widgettkinter.dnd
--- Drag and drop supporttkinter.ttk
--- Tk themed widgets- IDLE
- Outils de développement
typing
— Prise en charge des annotations de typepydoc
--- Documentation generator and online help system- Python Development Mode
doctest
--- Test interactive Python examplesunittest
--- Unit testing frameworkunittest.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
- Débogueur et instrumentation
- Paquets et distribution de paquets logiciels
- Environnement d'exécution Python
sys
--- System-specific parameters and functionssys.monitoring
--- Execution event monitoringsysconfig
--- Provide access to Python's configuration informationbuiltins
--- Built-in objects__main__
--- Top-level code environmentwarnings
--- Warning controldataclasses
--- Data Classescontextlib
— Utilitaires pour les contextes s'appuyant sur l'instructionwith
abc
--- 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
- Interpréteurs Python personnalisés
- Importer des modules
zipimport
--- Import modules from Zip archivespkgutil
--- Package extension utilitymodulefinder
--- Find modules used by a scriptrunpy
--- Locating and executing Python modulesimportlib
--- 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
- Services du Langage Python
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
- Services spécifiques à MS Windows
- Services spécifiques à Unix
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
- Modules command-line interface (CLI)
- Modules remplacés
- Security Considerations