加载中...
  1. Home
  2. Computing & Technology
  3. Python

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.
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).
What is Python?
Programming is an object-oriented interpreted language.
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 <b>String</b>. 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.
Regular Expressions Primer
A regular expression is an expression that describes a set of strings. One does not use regular expressions
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.
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.
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.
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.
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.
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.
Python Exceptions
This tutorial is part of a series designed to help you learn to program in Python. This tutorial looks specifically at the exceptions, errors, and warnings within Python while using raise. This step looks at raising your own exceptions with raise.
Beginning Python: Syntax
As with everything in Python, files are objects. To open a file object, you must assign it to a variable
Forming RegEx
Every successful Python programmer understands Python's regular expression (regex) system and how to formulate regular expressions for matching. Understanding regex is key to Python programming. How do you match some but not all of a list? Use Python's regular expressions to your advantage.
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.
Beginning Python
Another means of controlling the flow is to say "If : ." Obviously,
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.
A Python Web Client
The first step in programming toward the Internet is to tell Python to create a socket object. Here is how to do it.
Getting a Line With Python
Getting a line from a file is easy with Python. This tip shows you how.
Python CGI
This tutorial discusses how to use Python to receive and process data from the Common Gateway Interface (CGI). It assumes that you are familiar with CGI basics. If you are not, you should first work through the material at <a href="http://webdesign.about.com/od/cgi/index.htm">About.com's Webdesign site</a>.
Python Encodings
Python can also encode ASCII text as Unicode, not merely Unicode as ASCII.
Self-Documenting Code
Python has built-in documentation features. Here is how to write self-documenting functions.
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.
HTML Forms with Python
This tutorial discusses how to use Python and CGI to create plain HTML pages and HTML forms.
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.
Python's Exceptions
Python's built-in exceptions are many; knowing them really helps your programming.
Python and PostgreSQL
This tutorial teaches how to read data from a PostgreSQL database using psycopg.
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.
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.
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.
MySQL Insertion
If you want to insert data into a MySQL database repeatedly and without worrying about SQL syntax, this tutorial is for you.
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.
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.
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.
RSS Reader Code
This page links to the source code for the tutorial series on building an RSS Reader with Python.
<!--#echo var="sdpn" --> - Step By Step<!--#echo var="zmT" -n-->
Articles Index A Guide to Text vs Data in Python 3.0 The difference between text and data is critical
Review of Beginning Python
Beginning Python is currently the best book for the beginning programmer. The author takes the reader
An Introduction to wxPython
WXPython is a very powerful and easy-to-use graphical user interface (GUI) toolkit. Because it is as
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.
Using PHP-Javascript for CGI
Javascript watches user actions and behavior and initiates actions accordingly. Here we submit a form without the usual 'Submit' button.
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
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.
Accessing MySQL with Python
In this tutorial, we will query a MySQL database for a value which we take from user input. To do this,
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.
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.
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.
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.
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.
RSSReader.py
Python Code for an RSS Reader
Bang Line
'Bang Line' defined.
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.
Shell
: When speaking of Python programming, there are two shells that are commonly referenced. The first is
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.
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.
Text vs Data in Python 3.0
The difference between text and data is critical for programming in Python 3.0. One of the key areas impacted by this is the variable type - str and bytes.
Python Decorators
The built-in Python function classmethod() was a pre-cursor to Python's decorators.
Pt 2: The Feed Address
Here we read the RSS feed as a Python file object in order to process it for the RSS Reader in Python.
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.
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.
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.
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.
Python Regex: Characters
Python's regular expression (regex) engine is very powerful. This page discusses special characters.
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.
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
Python Regex: the Colon
Python's regular expression (regex) engine is very powerful. This page discusses the use of the colon.
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.
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.
Boolean Operations
Boolean operators are a significant part of Python programming. Here is a reference on how to use them.
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.
Python Regex: the Dot
Python's regular expression (regex) engine is very powerful. This page discusses the dot symbol.
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 using os.lseek() and os.read().
Suggested Resources: On-line
This page offers links to online resources for learning and applying Python to your daily tasks. While most of the resources listed here are for the beginner, some are geared for more advanced learners.
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.
"Hello, World" in Tkinter
As in the say_hello method of Greeter, we need to create a main frame. We here do that in the main()
Python for System Admin
Python for Unix and Linux System Administration is an excellent survey of how to use Python to administer Linux and Unix systems.
Regular Expression Objects
Python's <b>re</b> 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
Python Regex: Backslash
Python's regular expression (regex) engine is very powerful. This page discusses the backslash.
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'.
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.
RegEx Examples: Inequality
Python's regular expression (regex) engine is very powerful. This page discusses square braces or brackets.
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.
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 <b>re</b> 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.
Mutable Sequences
Python supports several operations that modify objects in situ. These are called mutable because no output is necessary. Here is a guide to what they are and how they are used.
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.
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: the Dollar Sign
Python's regular expression (regex) engine is very powerful. This page discusses the dollar sign.
Pythons 're' Module
Python's <b>re</b> 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.
Building an Email Whitelist
Training an email 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 the main() function for creating such a whitelist.
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.
Sequence Types
Python supports several kinds of sequences. Here is a guide to each.
Iterators
Python's iterators are very powerful and helpful. Here is a guide to the iterator protocol used in Python.
The Definitive Guide to Django
Django is as close as one can get to a 'standard' web framework for Python. This book pledges to take you from beginner to expert in just over 400 pages, and it delivers.
  1. Home
  2. Computing & Technology
  3. Python

©2011 About.com. All rights reserved. 

A part of The New York Times Company.