Python

From ArchWiki
Revision as of 08:22, 27 March 2009 by Xelados (Talk | contribs) (updated the "Learning Python" link to reflect the current (3rd) edition)

Jump to: navigation, search

Introduction

This entry will cover installing Python, and provide some references.

Installation

To install the latest stable version of Python, you may safely run;

# pacman -S python

If you would like to build the latest rc/betas from source, visit here. The AUR also contains good PKGBUILDS. If you do decide to build the RC, note that the binary (by default) installs to /usr/local/bin/pythonX.x.

Misc. Uses

Python is excellent for emergency situations, or when you simply need to work with files without writing any Perl, Bash, or C. Here are some functions that I have found to be helpful (although this is by no means a comprehensive list);

open - open a file
urllib.urlopen - open a web page
urllib.urlretrieve - download a file (by default, to /tmp, but a directory can be specified)
os.listdir - list all files in a given directory

You will find that Python is used frequently, in applications ranging from the GIMP, to Sage. Python's scalability, popularity, and ease of coding makes it an important addition to all desktops.

More Resources

  • Learning Python is one of the most comprehensive, up to date, and well-written books on Python avavilable today.
  • Dive Into Python is an excellent (free) resource, but perhaps for more advanced readers.

For GUI or Game programming, Google is your only hope.

For Fun

>>> import this