The Python Tutorial 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. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, and may be freely distributed. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. For a description of standard objects and modules, see The Python Standard Library. The Glossary is also worth going through.
Dive Into Python 3 You are here: • Dive Into Python 3 Dive Into Python 3 covers Python 3 and its differences from Python 2. Compared to Dive Into Python, it’s about 20% revised and 80% new material. The book is now complete, but feedback is always welcome. Table of Contents (expand) Also available on dead trees! The book is freely licensed under the Creative Commons Attribution Share-Alike license. you@localhost:~$ git clone © 2001–11 Mark Pilgrim
Python Programming Python Programming From Wikibooks, open books for an open world Jump to: navigation, search This book describes Python, an open-source general-purpose interpreted programming language available for a broad range of operating systems. Contents Intro Overview Getting Python Setting it up Interactive mode Self Help Basics Creating Python programs Variables and Strings Basic syntax Sequences (Strings, Lists, Tuples, Dictionaries, Sets) Data types Numbers Strings Lists Tuples Dictionaries Sets Basic Math -- redundant to "Operators" Operators Control Flow Decision Control Conditional Statements Loops Functions Scoping Input and output Files Text Modules Classes Exceptions Errors Source Documentation and Comments Idioms Advanced Decorators Context Managers Reflection Metaclasses Namespace Tips and Tricks Modules Standard library modules Standard Library Regular Expression External commands XML Tools Email Threading Sockets GUI Programming Tkinter CGI interface WSGI web programming Extracting info from web pages Math
Building Skills in Python — S.Lott v4.2 Site How do you learn Python? By doing a series of exercises, each of which adds a single new feature of the language. This 450+ page book has 42 chapters that will help you build Python programming skills through a series of exercises. This book includes six projects from straight-forward to sophisticated that will help solidify your Python skills. The 2.6 edition was significantly revised and expanded to cover Python 2.6 and some elements of Python 3.1. Many chapters have been updated, reorganized and added since the 2.5 edition. The current release has benefitted from a great deal of support from readers who sent detailed lists of errors and suggestions. Professional programmers who need to learn Python are this book’s primary audience. Since Python is simple, we can address newbie programmers who don’t have deep experience in a number of other languages.
PythonTurtle Ressources Python Ressources didactiques Gérard Swinnen Vous trouverez ci-dessous : en téléchargement libre, les versions numériques de l'ouvrage "Apprendre à programmer avec Python" de Gérard Swinnen (troisième et cinquième éditions), anciennement publié aux éditions O'Reilly et dorénavant édité chez Eyrolles (ISBN 978-2-212-13434-6) ; le code source des exemples et exercices proposés dans le livre ;Les diapositives et le code source des exemples présentés par G.Swinnen au colloque "Libr'East of Paris" (IUT de Marne-la-vallée) les 23 & 24 Avril 2004 ;Les diapositives de la conférence sur Python présentée à l'IUT de Vannes (Université de Bretagne Sud), le 15 Avril 2005 ;La traduction du livre en hongrois (+ lien vers le site web du traducteur).La traduction du livre en arabe (+ lien vers le site web des traducteurs). Les deux dernières éditions traitent de la version 3 de Python. Au sommaire : Préface. Pour le professeur qui souhaite un support de cours. *** Traduction hongroise *** *** Traduction arabe ***
A Python Book: Beginning Python, Advanced Python, and Python Exercises 2.2 Regular Expressions For more help on regular expressions, see: 2.2.1 Defining regular expressions A regular expression pattern is a sequence of characters that will match sequences of characters in a target. The patterns or regular expressions can be defined as follows: Literal characters must match exactly. Because of the use of backslashes in patterns, you are usually better off defining regular expressions with raw strings, e.g. r"abc". 2.2.2 Compiling regular expressions When a regular expression is to be used more than once, you should consider compiling it. import sys, re pat = re.compile('aa[bc]*dd') while 1: line = raw_input('Enter a line ("q" to quit):') if line == 'q': break if pat.search(line): print 'matched:', line else: print 'no match:', line Comments: We import module re in order to use regular expresions.re.compile() compiles a regular expression so that we can reuse the compiled regular expression without compiling it repeatedly. 2.2.3 Using regular expressions Notes:
Introduction to Electrical Engineering and Computer Science I | Electrical Engineering and Computer Science Python Introduction - Google's Python Class - Google Code Python is a dynamic, interpreted language. Source code does not declare the types of variables or parameters or methods. This makes the code short and flexible, and you lose the compile-time type checking in the source code. An excellent way to see how Python code works is to run the Python interpreter and type code right into it. $ python ## Run the Python interpreterPython 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> a = 6 ## set a variable in this interpreter session >>> a ## entering an expression prints its value6>>> a + 28>>> a = 'hi' ## a can hold a string just as well>>> a 'hi'>>> len(a) ## call the len() function on a string2>>> foo(a) ## try something that doesn't workTraceback (most recent call last): File " Python Program Python source files use the ".py" extension. #! Running this program from the command line looks like: