background preloader

Python

Facebook Twitter

Learn Python The Hard Way, 2nd Edition — Learn Python The Hard Way, 2nd Edition. Introduction to Python. Copyright (c) 2003 Dave Kuhlman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Introduction to Python

Abstract: This document is a syllabus for a first course in Python programming. This course contains an introduction to the Python language, instruction in the important and commonly used features of the language, and practical excercises in the use of those features. Contents Python is a high-level general purpose programming language. Think Python. Invent Your Own Computer Games with Python. Chapter 1 Read online: Chapter 1 - Installing Python Videos: Chapter 2 Read online: Chapter 2 - The Interactive Shell Chapter 3 Read online: Chapter 3 - Strings Download source: hello.py Copy source to clipboard: Use the online diff tool to find typos in your code: hello.py Chapter 4 Read online: Chapter 4 - Guess the Number Download source: guess.py Use the online diff tool to find typos in your code: guess.py Chapter 5 Read online: Chapter 5 - Jokes Download source: jokes.py Use the online diff tool to find typos in your code: jokes.py.

Invent Your Own Computer Games with Python

A Quick, Painless Tutorial on the Python Language. Norman Matloff University of California, Davis June 17, 2008 ©2003-2008, N.

A Quick, Painless Tutorial on the Python Language

Matloff Contents What Are Scripting Languages? Languages like C and C++ allow a programmer to write code at a very detailed level which has good execution speed (especially in the case of C). The term scripting language has never been formally defined, but here are the typical characteristics: Used often for system administration, Web programming, text processing, etc. Why Python? The first really popular scripting language was Perl. Advocates of Python, often called pythonistas, say that Python is so clear and so enjoyable to write in that one should use Python for all of one's programming work, not just for scripting work. Background Needed Anyone with even a bit of programming experience should find the material through Section 8 to be quite accessible. The material beginning with Section 10 will feel quite comfortable to anyone with background in an object-oriented programming (OOP) language such as C++ or Java. Python Web Server Gateway Interface v1.0.

Python currently boasts a wide variety of web application frameworks, such as Zope, Quixote, Webware, SkunkWeb, PSO, and Twisted Web -- to name just a few .

Python Web Server Gateway Interface v1.0

This wide variety of choices can be a problem for new Python users, because generally speaking, their choice of web framework will limit their choice of usable web servers, and vice versa. By contrast, although Java has just as many web application frameworks available, Java's "servlet" API makes it possible for applications written with any Java web application framework to run in any web server that supports the servlet API. The availability and widespread use of such an API in web servers for Python -- whether those servers are written in Python (e.g. Medusa), embed Python (e.g. mod_python), or invoke Python via a gateway protocol (e.g. This PEP, therefore, proposes a simple and universal interface between web servers and web applications or frameworks: the Python Web Server Gateway Interface (WSGI). The Application/Framework Side.

Quickstart — Flask 0.9dev documentation. Eager to get started?

Quickstart — Flask 0.9dev documentation

This page gives a good introduction to Flask. It assumes you already have Flask installed. If you do not, head over to the Installation section. A Minimal Application A minimal Flask application looks something like this: from flask import Flaskapp = Flask(__name__) @app.route('/')def hello_world(): return 'Hello World! ' Just save it as hello.py (or something similar) and run it with your Python interpreter. . $ python hello.py * Running on Now head over to and you should see your hello world greeting. So what did that code do? First we imported the Flask class. To stop the server, hit control-C. Externally Visible Server If you run the server you will notice that the server is only accessible from your own computer, not from any other in the network.

If you have debug disabled or trust the users on your network, you can make the server publicly available simply by changing the call of the run() method to look like this: Debug Mode There are two ways to enable debugging. <! Python Language. Python is an ObjectOriented language that does all the things that you can do with Perl or TCL - only better, since it was designed from the ground up as an OO language.

Python Language