Python Resources

 If you're not using Python, you're working too hard! Python logo

Python is a scripting language that is easy to learn, powerful and fun to use.

There are many excellent, free resources available on the Internet to help you learn and use Python. I list some here, many of these links will take you to other sites as well. Please explore!

Why Python?

These sites evangelize Python in various ways:

What is Python? summarizes all that is cool about Python. The story of Eric Raymond's journey to Python is here. The students at Yorktown High School made a fun and informative video about Python. An edited version, which is much smaller than the original, is here.

In this essay I give some of the reasons I like Python, with comparisons to Java in many cases.

Getting Started

The official Python web site is http://www.python.org.

The documentation that comes with Python is very good. If you are an experienced programmer, it may be all you need to get started. Download the distribution and read the tutorial.

For Beginners

The Beginner's Guide to Python lists many helpful resources including installation instructions and background material.

Python for Non-Programmers lists several tutorials aimed at beginning programmers. This page lists several books suitable for beginners. When you get stuck or have a question, join the python-tutor mailing list where you will find many friendly, helpful people.

The LiveWires Python Course is taught to teenagers at summer camp. The LiveWires worksheets include explanations and guided exercises including some graphics and games. LiveWires includes two modules that simplify graphics programming with Tkinter and Pygame.

Slightly more advanced...

Dave Kuhlman's Python 101 and Python 201 guides provide quick introductions to Python with many links to further details.

How to Think Like a Computer Scientist: Learning with Python is an introduction to computer science that also teaches Python programming.

Dive Into Python is an introduction to Python for experienced programmers.

Steve Ferg's web site has a variety of Python resources.

Common mistakes and gotchas

Much as I love Python, I have to admit that it isn't perfect and there are some common mistakes that trip up beginners. Here are some good references: (This list is excerpted from a post by Gene Tani to comp.lang.python.)

Graphics and GUI Programming

There are several packages available for graphics programming in Python.

Tkinter is perhaps the oldest and most common graphics package. It comes with the standard Python distribution on Windows. On MacOSX you must install TclTkAqua and rebuild Python (recipe). The Python web site has a page of Tkinter resources and the standard documentation has a section on Tkinter (in the Library Reference). Here is a Tkinter Wiki.

Two other resources for learning Tkinter are An Introduction to Tkinter and Thinking in Tkinter.

wxPython is another popular GUI library for Python. It is based on wxWidgets (formerly known as wxWindows). wxPython has many more standard widgets than Tkinter and seems to be the wave of the future.

Python bindings are also available for MFC (win32all), GTK (pyGTK) and Qt (pyQt).

Pygame is a graphics library oriented towards writing games, though it can also be used for other graphics-intensive applications. Start Programming is an online course that teaches Python programming using Pygame with a wrapper called pygsear.

Teaching Programming with Pygame also has some Pygame information.

Books

I recommend Learning Python and Jython Essentials for beginners with some programming background. If you have no previous programming experience, you might like Python Programming for the absolute beginner (read my review). Another good beginner's book is Python Programming: An Introduction to Computer Science.

Python in a Nutshell is an excellent descriptive summary of the Python language and libraries.

Python Cookbook has many recipes for specific tasks. It is a good way to stretch your knowledge of Python. The on-line Python cookbook is another source for code snippets.

There is an extensive list of introductory books here. Many of them have on-line versions.

I buy most of my technical books from bookpool.com, their prices are usually lower than those at Amazon.com.

Useful Modules

The path module is very helpful if you work with file and directory paths. It does many of the same things as os.path but it is much easier to use.

The ElementTree module is a good tool for simple processing of XML files. As of Python 2.5, it is included in the standard library as xml.etree.ElementTree.