Main

August 21, 2006

Discover Python, Part 8: Reading and writing data using Python's input and output functionality


Discover Python, Part 8: Reading and writing data using Python's input and output functionality
In this article, you learn how to work with files. First, we review a simple way to output data in Python, using the print statement, then learn about the file object, which is used by Python programs to read and write data to a file. The different modes with which a file can be opened are demonstrated, and the article concludes by showing how to read and write a binary file.

Discover Python, Part 8: Reading and writing data using Python's input and output functionality


Discover Python, Part 8: Reading and writing data using Python's input and output functionality
In this article, you learn how to work with files. First, we review a simple way to output data in Python, using the print statement, then learn about the file object, which is used by Python programs to read and write data to a file. The different modes with which a file can be opened are demonstrated, and the article concludes by showing how to read and write a binary file.

August 09, 2006

Python Web frameworks, Part 2: Web development with TurboGears and Python


Python Web frameworks, Part 2: Web development with TurboGears and Python
In this second article of a two-part series, we demonstrate TurboGears, another open source MVC-style Web application framework based on Python. Where the first article was an introduction to the Django framework, this one shows how to use TurboGears to create a Web-based shopping application and concludes with a comparison between Turbogears and Django.

May 02, 2006

Discover Python, Part 7: Explore the Python type hierarchy


Discover Python, Part 7: Explore the Python type hierarchy
This article returns to the exploration of the Python type hierarchy and introduces the Python dictionary container type. Unlike the Python tuple, string, and list container types discussed in previous articles, the dictionary type is an unordered container that relies on a key-to-value mapping. As a result, items in a dictionary are accessed by a key value and not by their location within a sequence. The unique features of the dictionary type may seem unusual, but they provide a great deal of power when used properly.

Discover Python, Part 9: Putting it all together


Discover Python, Part 9: Putting it all together
Previous articles in this Discover Python series have discussed a number of topics that confront beginning Python programmers, including variables, container objects, and compound statements. This article builds on these concepts to construct a complete Python program. It introduces Python functions and modules and shows how to build a Python program, store it in a file, and run it from the command line.

April 15, 2006

Charming Python: Scaling a new PEAK


Charming Python: Scaling a new PEAK
The Python Enterprise Application Kit (PEAK) is a Python framework for rapidly developing and reusing application components. While Python itself is already a very high-level language, PEAK provides even higher abstractions. One fairly recent capability added to PEAK is the capability to create generic functions and specifically to dispatch them on predicates, not simply on type. Sounds mysterious? Let's investigate.

April 05, 2006

Charming Python: Scaling a new PEAK


Charming Python: Scaling a new PEAK
The Python Enterprise Application Kit (PEAK) is a Python framework for rapidly developing and reusing application components. While Python itself is already a very high-level language, PEAK provides even higher abstractions. One fairly recent capability added to PEAK is the capability to create generic functions and specifically to dispatch them on predicates, not simply on type. Sounds mysterious? Let's investigate.

March 21, 2006

Discover Python, Part 4: Explore the Python type


Discover Python, Part 4: Explore the Python type hierarchy
Python provides a number of useful features, of which the list class is one of the most important. This article introduces the list class and demonstrates some of the many ways in which you can use it to simplify difficult programming tasks.

March 15, 2006

CherryPy for CGI programmers The CherryPy application framework


CherryPy for CGI programmers
The CherryPy application framework for Python makes Web applications easier to write than plain Common Gateway Interface (CGI). At the same time, it's simple -- not full of little-used features -- and easy to learn. This introduction shows everything needed to write Web applications with CherryPy.

March 06, 2006

Sockets programming in Python This tutorial shows how


Sockets programming in Python
This tutorial shows how to develop sockets-based networking applications using Python. In this tutorial, you first learn a few Python basics and see why Python makes a good network programming language. Then you move on to the basic sockets features of Python, using a sample chat application as a guide, and look at several other, high-level, classes that provide asynchronous communications.

February 13, 2006

Discover Python, Part 8: Reading and writing data


Discover Python, Part 8: Reading and writing data using Python's input and output functionality
In this article, you learn how to work with files. First, we review a simple way to output data in Python, using the print statement, then learn about the file object, which is used by Python programs to read and write data to a file. The different modes with which a file can be opened are demonstrated, and the article concludes by showing how to read and write a binary file.

February 09, 2006

Sockets programming in Python This tutorial shows how


Sockets programming in Python
This tutorial shows how to develop sockets-based networking applications using Python. In this tutorial, you first learn a few Python basics and see why Python makes a good network programming language. Then you move on to the basic sockets features of Python, using a sample chat application as a guide, and look at several other, high-level, classes that provide asynchronous communications.

February 07, 2006

Discover Python, Part 7: Explore the Python type


Discover Python, Part 7: Explore the Python type hierarchy
This article returns to the exploration of the Python type hierarchy and introduces the Python dictionary container type. Unlike the Python tuple, string, and list container types discussed in previous articles, the dictionary type is an unordered container that relies on a key-to-value mapping. As a result, items in a dictionary are accessed by a key value and not by their location within a sequence. The unique features of the dictionary type may seem unusual, but they provide a great deal of power when used properly.

January 28, 2006

Discover Python, Part 6: Programming in Python This


Discover Python, Part 6: Programming in Python
This article explores the Python for loop. The for loop is used to iterate through the items in a Python collection, including the Python tuple, string, and list container types discussed in previous "Discover Python" articles. The for loop can also be used to access elements from a container type by using the range (or xrange) method. In addition, you can use the range method to execute a group of statements a specific number of times within a for loop.

January 23, 2006

Sockets programming in Python This tutorial shows how


Sockets programming in Python
This tutorial shows how to develop sockets-based networking applications using Python. In this tutorial, you first learn a few Python basics and see why Python makes a good network programming language. Then you move on to the basic sockets features of Python, using a sample chat application as a guide, and look at several other, high-level, classes that provide asynchronous communications.

January 18, 2006

Discover Python, Part 6: Programming in Python This


Discover Python, Part 6: Programming in Python
This article explores the Python for loop. The for loop is used to iterate through the items in a Python collection, including the Python tuple, string, and list container types discussed in previous "Discover Python" articles. The for loop can also be used to access elements from a container type by using the range (or xrange) method. In addition, you can use the range method to execute a group of statements a specific number of times within a for loop.

January 13, 2006

Discover Python, Part 4: Explore the Python type


Discover Python, Part 4: Explore the Python type hierarchy
Python provides a number of useful features, of which the list class is one of the most important. This article introduces the list class and demonstrates some of the many ways in which you can use it to simplify difficult programming tasks.

January 09, 2006

Discover Python, Part 3: Explore the Python type


Discover Python, Part 3: Explore the Python type hierarchy
Unlike many other programming languages, the Python language does not include a special data type to handle a single character, such as "a" or "z." In contrast, Python takes a different approach: It uses a class designed especially for holding sequences of characters. This article introduces the string class and demonstrates different ways in which you can use a string within Python.

January 04, 2006

Discover Python, Part 7: Explore the Python type


Discover Python, Part 7: Explore the Python type hierarchy
This article returns to the exploration of the Python type hierarchy and introduces the Python dictionary container type. Unlike the Python tuple, string, and list container types discussed in previous articles, the dictionary type is an unordered container that relies on a key-to-value mapping. As a result, items in a dictionary are accessed by a key value and not by their location within a sequence. The unique features of the dictionary type may seem unusual, but they provide a great deal of power when used properly.

December 19, 2005

Building and filling out templates with Python and Cheetah After


Building and filling out templates with Python and Cheetah
After reading this article, you'll be able to generate any kind of text-based content with Python scripts and Cheetah templates. Cheetah templates are easy to understand and maintain, and they help you separate the static parts of a document from the dynamic parts.

December 16, 2005

Discover Python, Part 5: Programming in Python This article begins


Discover Python, Part 5: Programming in Python
This article begins to demonstrate how to do things in Python by focusing on flow control, which is one of the simplest methods for writing programs. In this programming model, data is manipulated -- perhaps from a user interface, sensors, or a file; depending on the value of the data or resulting expressions, different actions are taken. Python provides several flow control mechanisms. This article discusses the if statement, and the while and for loops.

December 14, 2005

Charming Python: Scaling a new PEAK The Python Enterprise Application


Charming Python: Scaling a new PEAK
The Python Enterprise Application Kit (PEAK) is a Python framework for rapidly developing and reusing application components. While Python itself is already a very high-level language, PEAK provides even higher abstractions. One fairly recent capability added to PEAK is the capability to create generic functions and specifically to dispatch them on predicates, not simply on type. Sounds mysterious? Let's investigate.

December 11, 2005

Connecting databases to Python with SQLObject An object-relational mapping tool


Connecting databases to Python with SQLObject
An object-relational mapping tool helps improve your productivity by providing classes and objects to manipulate database tables. The best object-relational mapping tool for Python is SQLObject -- an open-source project that does just about everything you might need to program a database. This article introduces SQLObject and its capabilities. After reading this article, you'll be able to connect Python to databases without writing any SQL code.

December 03, 2005

Connecting databases to Python with SQLObject An object-relational mapping tool


Connecting databases to Python with SQLObject
An object-relational mapping tool helps improve your productivity by providing classes and objects to manipulate database tables. The best object-relational mapping tool for Python is SQLObject -- an open-source project that does just about everything you might need to program a database. This article introduces SQLObject and its capabilities. After reading this article, you'll be able to connect Python to databases without writing any SQL code.

December 01, 2005

Discover Python, Part 3: Explore the Python type hierarchy Unlike


Discover Python, Part 3: Explore the Python type hierarchy
Unlike many other programming languages, the Python language does not include a special data type to handle a single character, such as "a" or "z." In contrast, Python takes a different approach: It uses a class designed especially for holding sequences of characters. This article introduces the string class and demonstrates different ways in which you can use a string within Python.

November 30, 2005

Connecting databases to Python with SQLObject An object-relational mapping tool


Connecting databases to Python with SQLObject
An object-relational mapping tool helps improve your productivity by providing classes and objects to manipulate database tables. The best object-relational mapping tool for Python is SQLObject -- an open-source project that does just about everything you might need to program a database. This article introduces SQLObject and its capabilities. After reading this article, you'll be able to connect Python to databases without writing any SQL code.

November 29, 2005

Discover Python, Part 6: Programming in Python This article explores


Discover Python, Part 6: Programming in Python
This article explores the Python for loop. The for loop is used to iterate through the items in a Python collection, including the Python tuple, string, and list container types discussed in previous "Discover Python" articles. The for loop can also be used to access elements from a container type by using the range (or xrange) method. In addition, you can use the range method to execute a group of statements a specific number of times within a for loop.

November 28, 2005

Discover Python, Part 3: Explore the Python type hierarchy Unlike


Discover Python, Part 3: Explore the Python type hierarchy
Unlike many other programming languages, the Python language does not include a special data type to handle a single character, such as "a" or "z." In contrast, Python takes a different approach: It uses a class designed especially for holding sequences of characters. This article introduces the string class and demonstrates different ways in which you can use a string within Python.

November 02, 2005

Discover Python, Part 6: Programming in Python This article explores


Discover Python, Part 6: Programming in Python
This article explores the Python for loop. The for loop is used to iterate through the items in a Python collection, including the Python tuple, string, and list container types discussed in previous "Discover Python" articles. The for loop can also be used to access elements from a container type by using the range (or xrange) method. In addition, you can use the range method to execute a group of statements a specific number of times within a for loop.

October 31, 2005

Sockets programming in Python This tutorial shows how to develop


Sockets programming in Python
This tutorial shows how to develop sockets-based networking applications using Python. In this tutorial, you first learn a few Python basics and see why Python makes a good network programming language. Then you move on to the basic sockets features of Python, using a sample chat application as a guide, and look at several other, high-level, classes that provide asynchronous communications.