background preloader


Facebook Twitter

Reportlab: Converting Hundreds of Images Into PDFs. 01.import glob 02.import os 03.import re.

Reportlab: Converting Hundreds of Images Into PDFs

Python Class Attributes are Evaluated on Declaration. In Python, class attributes are evaluated and put into memory when the class is defined (or imported).

Python Class Attributes are Evaluated on Declaration

For example, if you run the following code in an interactive interpreter, it will print out "Something __init__() called": Parsing Fixed-Length File Records with Python. 1inShare I’ve recently had to deal with parsing fixed-length file records and found struct.unpack and namedtuple to be a pretty useful and concise combination for the task:

Parsing Fixed-Length File Records with Python

How-to: Python Data into Graphite for Monitoring Bliss. 0inShare We Recommend These Resources This post shows code examples in Python (2.7) for sending data to Graphite.

How-to: Python Data into Graphite for Monitoring Bliss

Once you have a Graphite server setup, with Carbon running/collecting, you need to send it data for graphing. Basically, you write a program to collect numeric values and send them to Graphite's backend aggregator (Carbon). To send data, you create a socket connection to the graphite/carbon server and send a message (string) in the format: 1. Getting started with couchdb-python — couchdb-python v0.8 documentation. Some snippets of code to get you started with writing code against CouchDB.

1. Getting started with couchdb-python — couchdb-python v0.8 documentation

Starting off: >>> import couchdb>>> couch = couchdb.Server() This gets you a Server object, representing a CouchDB server. Invent Your Own Computer Games with Python - Learn how to program with a free ebook programming tutorial. Chapter 1 Read online: Chapter 1 - Installing Python Videos: Chapter 2 Read online: Chapter 2 - The Interactive Shell Chapter 3.

Invent Your Own Computer Games with Python - Learn how to program with a free ebook programming tutorial

Home. When CivilizationTM IV (Firaxis Games, published by Take2) was announced, one of the most exciting features was that much of the scripting code will be in python, and the game data in XML.


This tutorial attempts to teach you the basics of python programming that you could use with civIV. Of course, this tutorial is not limited to those who want to play a slow-paced turn-based strategy game. That is what it was written for, but is perfectly useful to any person with no programming knowledge at all, who wants to learn python. But what makes this tutorial unique, is that it is written for beginners, by a beginner. Writing your first Django app, part 1. Let’s learn by example.

Writing your first Django app, part 1

Throughout this tutorial, we’ll walk you through the creation of a basic poll application. It’ll consist of two parts: A public site that lets people view polls and vote in them.An admin site that lets you add, change and delete polls. We’ll assume you have Django installed already. You can tell Django is installed and which version by running the following command: Learn Python The Hard Way, 2nd Edition — Learn Python The Hard Way, 2nd Edition. Welcome to the 3rd Edition of Learn Python the Hard Way.

Learn Python The Hard Way, 2nd Edition — Learn Python The Hard Way, 2nd Edition

You can visit the companion site to the book at where you can purchase digital downloads and paper versions of the book. The free HTML version of the book is available at How long does this course take? You should take as long as it takes to get through it, but focus on doing work every day. Some people take about 3 months, others 6 months, and some only a week.

What kind of computer do I need? Developer Zone - This is a distributed, volunteer project with many contributors.

Developer Zone -

The best way to join our effort is to browse around, read the last section of this page to learn about our vision and plans, and then announce your intent to help on one of the developer Mailing Lists or contact any of the folks listed on this page. SciPy is managed by a broad community of diverse users. The mailing lists are the best way to get to know the currently active community. The github activity logs also shows who has been active in the community. Respect might be given to original code authors if they are still active on the lists. Make contributions (e.g. code patches), feature requests and file bug reports by submitting a "ticket" on the Trac pages linked below. Note that NumPy contains the most basic numerical functionality, and SciPy is layered on top of NumPy to provide a much wider range of capability. Python Tutorials, more than 300, updated March 2, 2009 and carefully sorted by topic and category.

Audio Podcasts from PyCon 2009 ShowMeDo's Learning Path Tutorials. The Python Standard Library — Python v2.7.2 documentation. 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 library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming. Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform-neutral APIs.

Notes on Python variable scope. Notes on Python variable scope Example 1: The difference between global and local variables¶ Global variables are accessible inside and outside of functions. Local variables are only accessible inside the function. In the example below, the function can access both the global and the local variable. However, trying to access the local variable outside the function produces an error. global_var = 'foo'def ex1(): local_var = 'bar' print global_var print local_var ex1()print global_varprint local_var # this gives an error foo bar foo Traceback (most recent call last): File "", line 12, in.