background preloader

La bibliothèque standard — Documentation Python 3.7.5

La bibliothèque standard — Documentation Python 3.7.5
While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the optional components that are commonly included in Python distributions. Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table of contents listed below. The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. In addition to the standard library, there is an active collection of hundreds of thousands of components (from individual programs and modules to packages and entire application development frameworks), available from the Python Package Index. Related:  OUTILS NUMERIQUES • programmation

Python (langage) Il est également apprécié par certains pédagogues qui y trouvent un langage où la syntaxe, clairement séparée des mécanismes de bas niveau, permet une initiation aisée aux concepts de base de la programmation[5]. Selon l'Index TIOBE, notamment en raison de son efficacité pour l'apprentissage automatique, sa popularité va croissante ; et en 2022 n'a toujours pas montré de signe de ralentissement[6]. Python est un langage de programmation qui peut s'utiliser dans de nombreux contextes et s'adapter à tout type d'utilisation grâce à des bibliothèques spécialisées. C'est l'un des langages les plus utilisés dans le domaine de l'informatique quantique[7] et de l'intelligence artificielle, ainsi que pour le traitement des Big Data et du Machine learningRetrait des sources lebigdata.fr : plagiat ; pas de transparence Projet:Sources/Enquête_genAI_:_analyse_détaillée#lebigdata.fr[réf. nécessaire]. Andrew M. Python 2.1 est une version dérivée de Python 1.6.1 et de Python 2.0. Et commerciaux :

Welcome to Flask — Flask Documentation (1.1.x) Overview Built-in Functions — Python 3.9.1 documentation Open file and return a corresponding file object. If the file cannot be opened, an OSError is raised. See Reading and Writing Files for more examples of how to use this function. file is a path-like object giving the pathname (absolute or relative to the current working directory) of the file to be opened or an integer file descriptor of the file to be wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed unless closefd is set to False.) mode is an optional string that specifies the mode in which the file is opened. The default mode is 'r' (open for reading text, a synonym of 'rt'). As mentioned in the Overview, Python distinguishes between binary and text I/O. Note Python doesn’t depend on the underlying operating system’s notion of text files; all the processing is done by Python itself, and is therefore platform-independent. buffering is an optional integer used to set the buffering policy. The newly created file is non-inheritable.

imghdr — Determine the type of an image — Python 3.8.0 documentation Source code: Lib/imghdr.py The imghdr module determines the type of image contained in a file or byte stream. The imghdr module defines the following function: imghdr.what(filename, h=None) Tests the image data contained in the file named by filename, and returns a string describing the image type. The following image types are recognized, as listed below with the return value from what(): New in version 3.5: The exr and webp formats were added. You can extend the list of file types imghdr can recognize by appending to this variable: imghdr.tests A list of functions performing the individual tests. The test function should return a string describing the image type if the test succeeded, or None if it failed. Example: >>> import imghdr>>> imghdr.what('bass.gif')'gif'

Avec Verona, Microsoft sécurise la programmation à la sauce Rust Bientôt open source, Project Verona adopte une approche différente de la propriété des objets et de la concurrence qui permet de renforcer la sécurité de la gestion de la mémoire. Microsoft tente par la même occasion de travailler sur le langage Rust, qui séduit de plus en plus de développeurs. Microsoft a constaté que 70 % des vulnérabilités de sécurité qu’elle devait traiter étaient liées à des problèmes de sécurité de la mémoire. Pour faciliter l'écriture d'un code plus sûr, l’éditeur a développé un langage pour la programmation d'infrastructures sécurisées. La première version du nouveau langage appelé Project Verona, sera bientôt disponible en open source. - Libre concurrence entre les données : le langage renonce aux mutations simultanées et arbitraires pour permettre une gestion évolutive de la mémoire avec une sécurité temporelle sans synchronisation globale. - Des régions linéaires, avec un modèle de propriété basé sur des groupes d'objets.

Coding style, coding style, CODING STYLE!!!! Besides the while statement just introduced, Python knows the usual control flow statements known from other languages, with some twists. 4.1. if Statements Perhaps the most well-known statement type is the if statement. For example: >>> x = int(input("Please enter an integer: "))Please enter an integer: 42>>> if x < 0:... x = 0... print('Negative changed to zero')... elif x == 0:... print('Zero')... elif x == 1:... print('Single')... else:... print('More')...More There can be zero or more elif parts, and the else part is optional. 4.2. for Statements The for statement in Python differs a bit from what you may be used to in C or Pascal. >>> # Measure some strings:... words = ['cat', 'window', 'defenestrate']>>> for w in words:... print(w, len(w))...cat 3window 6defenestrate 12 If you need to modify the sequence you are iterating over while inside the loop (for example to duplicate selected items), it is recommended that you first make a copy. 4.3. >>> for i in range(5):... print(i)...01234

asweigart/PythonStdioGames: A collection of text-based games written in Python 3 that only use "standard i/o". FrenchLanguage Links to Python information in French. ISO 639-1 Code: fr français Page Python (langage) en Français sur Wikipedia. Groupes d'Utilisateurs AFPy - Association Francophone Python, groupe d'utilisateurs Python francophone. Ressources Diverses Documentation traduite en français, documentation officielle, traduite en français. Livres Cours de programmation Python (2 & 3), par Gérard Swinnen. Blogs CategoryLanguage Cobol, 60 ans, toujours aux commandes Il y a 60 ans naissait un langage orienté entreprise, ouvert et orienté problème, Cobol. Parmi ses concepteurs, les informaticiennes Grace Hopper et Jean Sammet. Aujourd'hui, de nombreux systèmes critiques dans les secteurs de la banque, de la santé et des communications, continuent à s'appuyer sur sa puissance et sa stabilité. C’est en 1959 que Cobol, langage roi des mainframes, est apparu pour la première fois sous son nom le destinant à l’entreprise, Common Business Oriented Language. Plus précisément, Cobol résulte d’un framework de spécification créé en septembre 1959, ainsi que le rappelle Micro Focus, qui reste aujourd'hui l’un des principaux spécialistes avec IBM du langage de programmation. L’objectif était alors d’aider les professionnels à communiquer plus facilement avec les ordinateurs. Avec l’informaticienne américaine Grace Hopper aux commandes, la première incarnation du langage, nom de code Cobol-60, prit forme en un an.

6.2. re — Regular expression operations — Python v3.2.2 documentation This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings (str) as well as 8-bit strings (bytes). However, Unicode strings and 8-bit strings cannot be mixed: that is, you cannot match a Unicode string with a bytes pattern or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string. Regular expressions use the backslash character ('\') to indicate special forms or to allow special characters to be used without invoking their special meaning. The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'. It is important to note that most regular expression operations are available as module-level functions and methods on compiled regular expressions. Regular Expression Syntax (Dot.) (Caret.) {m} {m,n} (?

Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns 3. Affichage - Cours de Python 3.1 La fonction print() Dans le chapitre 1, nous avons rencontré la fonction print() qui affiche une chaîne de caractères (le fameux "Hello world!"). En fait, la fonction print() affiche l'argument qu'on lui passe entre parenthèses et un retour à ligne. Ce retour à ligne supplémentaire est ajouté par défaut. Si toutefois, on ne veut pas afficher ce retour à la ligne, on peut utiliser l'argument par « mot-clé » end : Ligne 1. Ligne 3. Ligne 4. Une autre manière de s'en rendre compte est d'utiliser deux fonctions print() à la suite. La fonction print() peut également afficher le contenu d'une variable quel que soit son type. Il est également possible d'afficher le contenu de plusieurs variables (quel que soit leur type) en les séparant par des virgules : Python a écrit une phrase complète en remplaçant les variables x et nom par leur contenu. 3.2 Écriture formatée 3.2.1 Définitions Que signifie « écriture formatée » ? Définition Que signifie f-string ? 3.2.2 Prise en main des f-strings Remarque

Porting Python 2 Code to Python 3 — Python 3.7.4 documentation Once you feel like you know what is different in Python 3 compared to Python 2, it’s time to update your code! You have a choice between two tools in porting your code automatically: Futurize and Modernize. Which tool you choose will depend on how much like Python 3 you want your code to be. Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. Unfortunately the tools can’t automate everything to make your code work under Python 3 and so there are a handful of things you will need to update manually to get full Python 3 support (which of these steps are necessary vary between the tools). Text versus binary data In Python 2 you could use the str type for both text and binary data. Making the distinction easier to handle can be accomplished by encoding and decoding between binary data and text at the edge of your code. To summarize: Use feature detection instead of version detection

Related: