A Byte of Python

The Perfect Anti-venom for your Programming Problems!

A Byte of Python is a book on programming using the Python language. It serves as a tutorial or guide to the Python language for anyone. If all you know is how to save text files, then this is an ideal beginner's book for you. If you are an expert programmer who loves C, Perl, Java or C#, you can also learn Python using this book.

In other words, 'A Byte of Python' is a free Python book for beginners as well as a free Python tutorial for experienced programmers who want to learn Python.

"A Byte of Python" has crossed 6000 downloads within 40 days of it's announcement!

Here are what people are saying about "A Byte of Python":

This is the best beginner's tutorial I've ever seen! Thank you for your effort.

- Walt Michalik (wmich50-at-theramp-dot-net)

You've made the best Python tutorial I've found on the Net. Great work. Thanks!

- Joshua Robin (joshrob-at-poczta-dot-onet-dot-pl)

I love it. I have never used Python before but this is all I need to get started with Python. Thanks!

- Fowler (fredri-dot-sandell-at-hotmail-dot-com)

I applaud the spirit of your endeavour. I like the style in which you write.

- Colin J. Williams (cjw-at-sympatico-dot-ca)

It is a very clear example-driven practical approach to understanding Python, one of the most powerful programming languages from the open source community.

- Nitin G R (nitin124-at-hotmail-dot-com)

I enjoyed reading your book. Keep up the good work.

- John Popplewell (john-at-johnnypops-dot-demon-dot-co-dot-uk)

Thank you for amazing work 'A Byte of Python' !

- Zhou Xiaohu (zhouxiaohu-at-263-dot-net-dot-cn)

Excellent work!

- Jaroslaw Zgoda (jaroslaw-dot-zgoda-at-generali-dot-pl)

(The following quote was automatically translated from French to English using Google!)

"Having bought various works treating of initiation with Python, I found insipid and rather intended them for developers confirmed in other languages which would wish to approach Python.

Today I finally found the book that I need, simple and didactic, really intended for nonprogrammers and approaching most of the characteristics of this language, while making comparisons with other languages of less high level, such as C, C++, C #, Java.

The most pleasant surprise is that this book, 'A Byte of Python' is free, consultable on line or to download. To even judge by you..."

Read more about this at rabhi.ouvaton.org

- Rabhi (http://rabhi.ouvaton.org)

I have also received very good feedback about 'A Byte of Python' from Eric S. Raymond (who coined the term 'Open Source' and whose article inspired me to learn Python in the first place), David Mertz (author of 'Charming Python' column) and Bruce Eckel (author of 'Thinking in C++' and 'Thinking in Java').

Official Recommendation

"A Byte of Python" has been listed on the Official Python website under the 'Full Tutorials' section, second only to the official documentation written by Guido van Rossum (the creator of Python) himself!

Contents at a Glance

  1. Introduction
  2. Installing Python
  3. First Steps
  4. Basics
  5. Operators and Expressions
  6. Control Flow
  7. Functions
  8. Modules
  9. Data Structures
  10. Problem Solving - Writing a Python Script
  11. Object-Oriented Programming
  12. Input/Output
  13. Exceptions
  14. The Python Standard Library
  15. More Python
  16. What Next?
  17. Appendices
    • Free/Libre and Open Source Software (FLOSS)
    • About

Latest Version 1.15 Released!

This new version involves some more minor revisions and additions. Thanks to all the helpful and active readers who have given suggestions, pointed out mistakes as well as offered a lot of help in so many ways.

If you have (still) find any errors or have suggestions for the book, please don't hesitate to send me a message.

I have received so many messages that I have been unable to keep track of all the names of readers of my book. However, special thanks goes to John Popplewell, Mike Peters and Colin J. Williams for a lot of suggestions, corrections and encouragement.

License Terms

This book is released under a Creative Commons License.

Some Rights Reserved

Read The Book

Please choose the server closest to you:


You can download the book in the following formats:

HTML files (with color and syntax highlighting), zipped (Recommended) http://www.g2swaroop.net/files/byte/byte_of_python_xhtml_115.zip
HTML single file (with color and syntax highlighting), zipped http://www.g2swaroop.net/files/byte/byte_of_python_xhtml_single_115.zip
PDF single file (new) http://www.g2swaroop.net/files/byte/byte_of_python_pdf_115.pdf
TXT single file, zipped http://www.g2swaroop.net/files/byte/byte_of_python_txt_115.zip
DocBook XML 4.2 source tarball http://www.g2swaroop.net/files/byte/byte_of_python_docbook_115.tgz


If you can help me with mirrors of the book, please send me a message.


If you want to translate this book to other human languages, please send me a message.


Dagur Pall Ammendrup (dagurp-at-heimsnet-dot-is) is in the process of translating the book to Icelandic language! Here's a little background information on Dagur and why he wants to translate "A Byte of Python" to Icelandic:

"My background... Well I'm a computer science student at the University of Iceland. I want to translate the book into Icelandic because I think that Python is the perfect language for beginners and there's almost no documentation in Icelandic for any programming language available on the web. I have an 11 year old sister who is interested in programming and I think this tutorial will be perfect for her once I've finished translating it."


Cristian F. Prieto (cprieto-at-info-servicios-dot-net) is translating the book to Spanish.


One of my readers is translating the book to Danish. (He wishes to remain anonymous for the moment)

More Listings


Replace -at- by @ and -dot- by . in the email addresses mentioned on this page.