1. Computing

Python: Most Popular Articles

These articles are the most popular over the last month.
"Hello, World!"
The purpose of this Hello World tutorial is to take a simple program and build upon it to illustrate the various elements of the Python language.
How a Computer Reads
Are you clueless about what a computer actually does with a program? If so, this tutorial is for you. It will tell you the basic parts of a program's composition and how the computer "sees" them.
What is Python?
This series of pages discusses what Python is, why one would want to use it, and how it differs from other programming languages.
Python Text Editors
Before you can start programming in Python, you must ensure you have the right equipment. In addition to having Python installed, you will need a text editor. Here I offer some suggestions on choosing one that you will meet your needs.
Line-By-Line File Analysis
This tip gives advice on analyzing a file one line at a time. This type of analysis is particularly useful when writing a program that will be run several times simultaneously (e.g., CGI scripts).
A Simple Python Web Server
Web servers are an invaluable part of the Internet. But sometimes Apache is over the top for a web service solution. Sometimes all you need is a little program to deliver data upon request. Here is how to build one with Python's socket module.
HTML Forms with Python
This tutorial discusses how to use Python and CGI to create HTML pages on the fly. It covers plain HTML pages as well as HTML forms. It assumes that you are familiar with CGI basics.
Beginning Python: Syntax
As with everything in Python, files are objects. To open a file object, you must assign it to a variable
Python Encodings
Python's encoding functions offer a means of encoding ASCII in Unicode and vice versa. Any program that might be used on the internet someday will need to work with multiple character sets. Here is how.
Beginning Python
Sometimes it is helpful to be able to just tell the computer to do something a certain number of times
Python Tutorials for Beginners
This series of tutorials is intended to help anyone learn to program in Python. If you are new to computers, however, you may benefit from the absolute beginner's tutorial: How a Computer Looks at Your Program.
MySQL Insertion
If you want to insert data into a MySQL database repeatedly and without worrying about SQL syntax, this tutorial is for you.
Python Exceptions
This tutorial is part of a series designed to help you learn to program in Python. This tutorial looks specifically at the errors, exceptions, and warnings within Python.
Running a Python Program
Programming is pointless if you cannot run, or execute, the program you write. Executing a Python program tells the Python interpreter to convert the Python program into something the computer can read and act upon. There are two ways to do this: using a Python shell and calling the Python interpreter with a "bang" line. The how-to's of both are addressed here.
RSS Reader in Python
An RSS Reader is a straightforward program, and building one ensures that one knows the basics of the language. It also teaches the basics of Python web programming and XML handling. Follow these step-by-step tutorials to build a web-based, customisable RSS Reader.
Self-Documenting Code
Python has built-in documentation features. Here is how to write self-documenting functions.
Python CGI
CGI passes information to Python in the form of a class called FieldStorage. In your Pythonic CGI script,
Python and PostgreSQL
In this tutorial, we will program Python to insert data into a PostgreSQL database. Here we see how to open the database using Python's psycopg module.
Create A Calendar In Python
Whether you want to develop a web-based diary or just want a calendar for your website, a dynamically created calendar in HTML is a very useful item to have. Creating one is a snap with Python's calendar module.
Regular Expressions Primer
A regular expression is an expression that describes a set of strings. One does not use regular expressions
Pickle Objects With Python
Python's pickle module is a quick and easy way to save Python objects in a standard format. Here is how to save and restore Python objects with pickle.
"Hello, World" in Tkinter
1. A Word on Tkinter and GUI Toolkits Tkinter is a graphic user interface (GUI) toolkit that comes with
Python's os Module
Python's os module provides a convenient interface for many system-level operations. This overview of the module shows how to interact dynamically with the operating system and runtime environment of the Python interpreter.
Testing CGI
Testing CGI scripts can be a tedious task, especially when you do not know the environmental variables under which you are programming. Here is a simple script that gives you the information you need.
String Methods - 1 of 2
Python's built-in string methods are incredibly powerful. As the name implies, each of the following methods are available through class String. Every string object is an instance of that class and has these methods available. This is the first of a two-part reference on Python's built-in string methods.
Getting a Line With Python
Getting a line from a file is easy with Python. This tip shows you how.
A Python Web Client
Network programming is not Python voodoo when you understand the basics of clients and servers. Here is how to build a basic web client in Python.
Port Scanning
Port scanning is a valuable facility for network programming as well as security testing for your network. Here is how to build a port scanner in Python.
Python's String Templates
Python's string module provides a Template class to process strings powerfully and en masse. Here is a description of the methods and the single attribute of this class and an example of how to use template string objects.
Pt 1: Laying the Groundwork
first step in any software project is understanding the problem and then laying the groundwork. Here we consider the tasks of an RSS Reader and lay the groundwork in HTML, CGI, and PHP.
An FTP Client in Python
FTP is a critical protocol for a host of networking solutions. Here is how to use Python's ftplib module to interact with FTP servers over an open connection.
Forming RegEx
Every successful Python programmer understands Python's regular expression (regex) system and how to formulate regular expressions for matching. Here is how you can do it.
set and frozenset
Python's built-in set types are helpful ways to create both mutable and immutable sets of values for use in your programming. Here are the functions and methods that you can use with each.
Shelve-ing Python Objects
Python's shelve module is a powerful way to include persistence and to save objects in an easy-access database format. Here is how to open, assign value to, restore value from, and close shelve dictionaries and databases.
Python's Exceptions
Python's built-in exceptions are many; knowing them really helps your programming.
Programming Securely
Programming for security is an imperative for the web programmer. Any sloppy coding can be exploited and amount to significant financial and personal losses. Here are some tips on programming Python securely.
Get POP3 Email with poplib
Getting your mail through POP3 is easy with Python's poplib library. Here is how to use getpass and poplib to script your mail retrieval and to make a local backup of your mailbox.
Beginning Python: Operators
This tutorial is part of a series designed to help you learn to program in Python. This tutorial looks specifically at the operators within Python.
Python Game Programming
If you simply cannot wait for About.com's tutorial on developing games in Python, you might try one of these tutorials. They cover the development of simple geometric games through to more complicated, arcade-style games.
Pt 3: Finishing the Program
The first step in any software project is understanding the problem and then laying the groundwork. Here we build a Python program that fetches RSS feeds and presents them in HTML via CGI or via PHP and Javascript
RSS Reader Code
This page links to the source code for the tutorial series on building an RSS Reader with Python.
Working With Files in Python
When computers are not reading code, they are processing data from or to files. These tips show you how to do some common tasks related to file input and output using Python.
Python Decorators
Decorators help the Python program with maintaining and extending Python programs.
Shell
: When speaking of Python programming, there are two shells that are commonly referenced. The first is
Using PHP-Javascript for CGI
So you have moved to a new job in data processing as part of web application development. At your old job, you used CGI for to process forms, but the new server does not allow CGI. The hotshot AJAX guru who left only has PHP and Javascript. You don't have time to muck about with Apache. What's a Python programmer supposed to do? Flourish and excel, and this tutorial will show you how.
Python String Constants
Python's string module provides many helpful constants that you can use in your programming. Here is each of the constants and a brief description of each.
Pt 2: The Feed Address
The first step in any software project is understanding the problem and then laying the groundwork. Here we consider the tasks of an RSS Reader and lay the groundwork in HTML, CGI, and PHP.
Python 2.5's 'with' Statement
One of the new features that was released with Python 2.5 last month is the 'with' statement. For those of you who are used to Python's try...except statement, you may find this to be the biggest boon of upgrading.
The socket Module - Pt1
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
The Shell vs The File
In Python, there are two ways to create a program: the Python shell and the text file. This article offers a brief overview of each and discusses their advantages and disadvantages.
RSSReader.py
Python Code for an RSS Reader
notation
Lambda calculus can be used to design just about any kind of function you might need. Here is how to use it in lieu of pseudo-code to describe your functions quickly.
Accessing MySQL with Python
1. Introducing MySQLdb! In this tutorial, we will query a MySQL database for a value which we take from
String Formatting Operations
Python's string formatting operations are important to know for most any program that you write. Here is a comprehensive guide to them.
Types of Peer-to-Peer Networks
One of the more avant-garde forms of network programming is peer-to-peer networking. Here is an introduction to what peer-to-peer entails and what it looks like in general terms.
Analyze A File All-At-Once
This tip gives advice on analyzing one or more files simultaneously using Python's dictionary data types. This type of analysis is useful for local analysis (as opposed to network server usage) when parts of one or more files need to be consulted simultaneously and in rapid succession.
Bang Line
'Bang Line' defined.
Checking URLs With Python
In the Wild World of the Web, checking the DNS entry of a URL or IP address is increasingly necessary. Here is how to do it with the Python socket module
What is a Regular Expression?
Regular expressions are a Python programmer's best friend. Understanding what they are and how to use them will help you leap tall programming tasks in a single bound.
Review of Beginning Python
Beginning Python is currently the best book for the beginning programmer. The author takes the reader
Text vs Data in Python 3.0
The difference between text and data is critical for programming in Python 3.0. Understanding this all-pervasive difference and how it relates to your programming will save you a lot of debugging time.
The Python Library
This page offers an overview of the most commonly used modules from the Python Standard Library. It is not intended as a replacement for the documentation. Rather, it highlights modules which factor into most general purpose programming projects.
Secure Python Programming
All but the simplest programs operate in a web-enabled environment. Navigating the (in)security of such an environment is notoriously difficult. This article looks briefly at the state of network security and what it means for Python programmers.
Get Login Info With getpass
Accepting login information in plain text is inherently dangerous from the persepctive of computer security. Fortunately, Python has the getpass module which allows the handling of login information without leaving a trace in a system's cache.
An Introduction to wxPython
1. Introducing WXPython WXPython is a very powerful and easy-to-use graphical user interface (GUI) toolkit.
Python Regex: the Dollar Sign
Python's regular expression (regex) engine is very powerful. This page discusses the dollar sign.
Python's File Descriptors
Python's os module handles much of the language's portability with respect to the local operating system. Here is how to do cross-platform system programming with Python.
The socket Module - Pt3
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
Transitioning from 2.x to 3.0
With the release of Python 3.0, the number of projects that are built on a 3.x interpreter and that break compatibility with the 2.x series and before will only increase. The points of incompatiblity vary in importance, but your 2.x coding style is almost guaranteed to be incompatible on some level. Here is a series of helps to ease your transition into the world of Python 3.0.
Python Regex: Curly Braces
Python's regular expression (regex) engine is very powerful. This page discusses curly braces.
RegEx Examples: \S
Python's regular expression (regex) engine is very powerful. This page discusses square braces or brackets.
Moving Around in a File
If you are familiar with reading a file into memory but still wonder how to move around inside it after that, this ScripTip will help you. Using the code from the earlier tip, this discussion shows how to access all or one record of the dictionary 'record'.
Python Regex: the Colon
Python's regular expression (regex) engine is very powerful. This page discusses the use of the colon.
Building an Email Whitelist
Training a spam filter can take a good deal of time and effort. Use an email whitelist to jumpstart the spam filter process. Here's how to create a whitelist of good email addresses for your spam filter.
Pt 4: Python Error Handling
A Python program is not fully-functional until it crashes the way you want, handling errors. Here we look at error checking for the Python-powered RSS Reader.
Python's Protocol Modules
HyperText Transfer Protocol (HTTP): HTTP is the basic protocol of the internet. With it, web pages are
RSSReader.cgi
Python CGI for an RSS Reader
Python Regex: Regex Negation
Python's regular expression (regex) engine is very powerful. This page discusses regex negation.
The socket Module - Pt2
Python's socket module is the foundational module for all network programming in Python. Here is a reference of the functions, classes, and constants available through it.
Boolean Operations
Boolean operators are a significant part of Python programming. Here is a reference on how to use them.
RegEx Examples: the Plus Sign
Python's regular expression (regex) engine is very powerful. This page discusses the dot symbol.
RSSReader.php
The PHP Layer for an RSS Reader
Bit String Operations
Python's bit string operations are an important part of advanced programming. Here you will find a reference to the bit-wise operators in Python.
Common Errors
This is a list of several common programming errors committed by beginners and advanced alike. If your program is not doing what you think you programmed it to do, if it keeps throwing an error and you do not know why, check this list to see if there is a common error which you are not seeing in your troubleshooting.
Python and Unicode
Multilingual processing in Python is important for Python web application development. This tutorial shows how to process multilingual texts for a Python-powered RSS Reader.
Pythons 're' Module
Python's re module is without a doubt one of the most commonly used parts of the Python library. Remember its functions, on the other hand, is not always easy. Here is a reference to help you keep it all straight.
Backup Your Gmail
Getting your Google mail through POP3 is easy with Python's poplib library. Here is how to use getpass and poplib to script your Gmail retrieval and to make a local backup of your mailbox.
Python Regex: Characters
Python's regular expression (regex) engine is very powerful. This page discusses special characters.
Comparison Operations
Python's comparison operations are pretty straightforward. Here is a reference to them with a bit of detail that you may not know.
Practical Django Projects
Django is as close as one can get to a 'standard' web framework for Python. This book mentors you through three real world projects and illustrates best practices for developing with Django.
RegEx MatchObjects
Python's re module is without a doubt one of the most commonly used parts of the Python library. Here is a reference of the methods and attributes available for every match of a regular expression.
Beginning Python - 2nd Edition
Beginning Python is fast becoming a classic introduction to the language. Here is my review of the second edition of Hetland's book.
Deprecated String Functions
Python's string module offers a bevy of functionality. Some of it, however, has been moved to the built-in string methods. Here are the functions that are deprecated.
Python Regex: the Question Mar
Python's regular expression (regex) engine is very powerful. This page discusses the question mark.
Numeric Types and Operations
Python recognises several types of numbers. Here is a reference for the numeric types that Python knows and what you can do with them.
Python's Warnings
Python's built-in warnings are important to know. Here is a list of them.
index.html
The index.html file for an RSS Reader in Python
Object-Oriented Programming in
Object-oriented programming in Python is a good introductory textbook for learning object-oriented programming using the Python language.
Regular Expression Objects
Python's re module is without a doubt one of the most commonly used parts of the Python library. Here is a reference of the methods and attributes available in each regex object
RegEx Examples: Curly Braces 3
Python's regular expression (regex) engine is very powerful. This page discusses the use of curly braces with question marks.
Sequence Types
Python supports several kinds of sequences. Here is a guide to each.
RDBMS
: RDBMS is the abbreviation for "relational database management system", a system for the creation, manipulation,
Classes
This is a glossary of the more technical terms used on About.com's Python site.

©2013 About.com. All rights reserved.