Stack OverflowHow to learn Python?
[+67] [20] Brett Veenstra
[2008-08-20 13:49:24]
[ python books ]

For a beginner's perspective, can you answer the following?

i recommend the following website for a python beginner - Michael
[+78] [2008-08-20 13:57:50] Eli Courtwright [ACCEPTED]

Best Tool(s): this depends on your preference as far as editors go. I prefer a simple editor with syntax highlighting and a few other features such as regular expression find/replace. So I'd recommend nedit for Linux or Notepad++ for Windows. Textmate for a Mac is supposed to also be really good. If you prefer a feature-heavy IDE then I recommend Eclipse with the PyDev plugin.

Best Book: if you're a beginning to programming then you should read either Learn Python the Hard Way [1] or Think Python [2] (a new edition of the older book How to Think Like a Computer Scientist: Learning With Python) and if you want a Python book for experienced programmers, then you want Dive Into Python [3]

Best Website: the books mentioned above are both freely available online. However, the official Python tutorial is a good reference for anyone learning the language, since it's well organized and explains Python's language syntax (how do if statements work, how do exceptions work, etc) and built-in types and classes (how do I perform common list operations, how do I deal with dates and times, etc). You can find this at

Best Problem Domain: Python is used by Google, Industrial Lights and Magic, The Washington Post, NASA, and everything in between. It's a general purpose programming language and is well suited to most tasks. However, it is increasingly popular with web developers, so you might want to try building a web application with Django once you familiarize yourself with the language:


(2) Your link to How to think like a computer scientist: learning python is broken. - Chris
@Chris: Thanks for pointing that out, the link has now been fixed. - Eli Courtwright
I have heard some bad things about dive into python. You might want to consider alternatives before trying dive into python. - Eric
(1) @Eric: I've looked at the alternatives and I still consider Dive Into Python to be the best resource I've seen for experienced programmers who are new to Python. Though I've just added a link to Learn Python the Hard Way since your reference to Zed Shaw made me think about it. - Eli Courtwright
[+20] [2010-03-20 06:36:03] Ray Vega

Google's Python Class [1]

...this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding... The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections...


[+15] [2008-08-21 00:09:54] akdom

Ok, so almost everything has already been stated, but two of my absolute favorites have yet to be: Python Pocket Reference (Third Edition is the most recent as of this post) by O'Reilly, and the Python Challenge [1]. I have to also throw a vote in support of the wonderful Dive Into Python which everyone I know who has learned python [2] adores [3], and the almighty iPython [4].

Honestly I could never fully stomach the giant tome which is O'Reilly's Programming Python though others I know have said good things about it. And though some people ( like bruceatk proves [5]) find Learning Python a good way to, well, learn python, but I could never really get engaged by it.

Here is where my two cents come into play. The Python Pocket Reference is a wonderful offline guide for all the builtin python functionality and a good bit of the core modules. And the damn thing is small enough to slide in a back pocket to boot (thus the Pocket Reference part I guess...). And since I like riddles & logic puzzles, the Python Challenge was a great way to get me engaged. These coupled with comp.lang.python [6], Dive Into Python, and the #python channel on [7], really got me started.

One last note on The Python Challenge. You mention "The Best Problem Domain" to get familiar with python using.... The Python Challenge is a very well done way of introducing programmers to the plethora of python modules. It shows you everything from pickle to basic image manipulation.

I hope this is of some help. (Oh, and one last resource, it's called StackOverflow [8]).


[+10] [2008-08-20 13:52:49] Baltimark

Eclipse IDE or even the quick and easy IDLE which comes with Python are great tools.

DiveIntoPython [1] is a nice HTML based tool to get Started.

If you're looking for math based problems, check out Project Euler [2]. It's got a lot of nice, simple problems that can really get you going on using some of the built in types, how to define functions, etc.


[+9] [2008-08-20 13:53:16] seanyboy

Google AppEngine [1] will allow you to create websites using Python. It's a good way to start learning Python with demonstrable world-visible projects.


(1) I've used app engine, and it's good, but it's not all python. For example, you have to use yaml config files. Plus you can't have clean model classes like you can with django, since app engine is non relational. - Igor Ganapolsky
[+8] [2008-08-20 13:55:22] poulejapon

The greatest tool to start Python might well be IPYTHON [1]. That's just an interactive shell.

It's way better than the original shell. It's in color, it supports autocompletion on your objects, hitting tab will lists all their methods, and have a nice way to navigate in your history.

It's a must if you just started Python.

For the documentation, the Python website [2] is great.

For the IDE, Eclipse now has a plugin called pydev [3] which is really good... But the editor you use is not really critical.


Aslo, there ipython notebook, it is great for experimenting and learning. - GrizzLy
[+4] [2008-11-26 03:34:35] crystalattice

I'm writing a Intro to Programming [1] book using Python. It's an ebook and will be free, if cost is a concern.


[+4] [2009-05-06 10:06:23] bastianneu

[+4] [2010-06-23 22:59:58] nrn

As a beginner there are a ton of resources out there. I believe in large part, thanks to the open source nature of Python, a ton of the best learning material is open content. Personally I found video tutorials a much better tool to get started, especially the first link below.

If you know at least a little bit about programming in any language, or just want a quick and dirty corporate style training:

If you don't know anything about programming, or are looking for an academic style slow but thorough introduction:

And for Python users of all levels there is something on:

[+4] [2010-08-31 17:17:53] Scott Lance is a pretty cool site that I used to pick up Python for the first time. Its a series of puzzles that can be solved by writing python programs. The puzzles and programs get progressively harder the further you go.

[+3] [2008-08-20 14:10:04] Corey

I learned Python from the Python tutorial [1] and the free, online e-book Dive Into Python [2].

A great second book is Programming Python [3], which will teach you more about the standard library, including threading, networking, GUI programming with Tk.


[+3] [2008-09-05 20:11:29] Tyler

If you already know how to code:

I think this is a great quick reference.

[+3] [2010-10-24 08:34:09] Igor Ganapolsky

I love me the Dreampie python client. It has very pleasant colors with syntax highlighting, and it allows you to save your history into HTML files. I just think that for fast prototyping it is more flexible to use than the regular python shell. As far as a full IDE, I recommend pyCharm. It is the most professional and polished IDE I have ever worked with. It's refectoring support, colors and fonts, svn integration, and overall usability is out of this world!

[+3] [2011-03-06 04:01:50] kctan

If you want a more hands-on approach of learning by practising. You can try [1]. There are about 170 questions currently for you to try out.


[+2] [2008-08-20 14:04:41] bruceatk

I use TextPad, so I can't recommend a Python IDE. Most of my Python programs are short utility programs to accomplish specific functions.

I used Learning Python [1] from O'Reilly to learn Python. I also have Programming Python [2] from O'Reilly.

I have Python mainly to manipulate XML. It is also the scripting language in Paint Shop Pro. It can be used for most anything though.

I really like Python. The only thing I don't like is that indention is such a key part of the program structure. This means it is really important not to be moving your source around between different programs that handle tabs/spaces differently. It's also important that you are consistent in your use of tabs/spaces to indent.


[+2] [2008-08-20 14:49:04] PabloG

To get started, I think IDLE [1] and the interactive command window is enough.

For GUI developement (wxPython), Boa Constructor [2] does the job, it has a GUI designer a la Delphi.

Books: beside Dive Into Python [3] (already mentioned), I can recommend wxPython in Action [4] for wxPython GUI developement and Python Programming on Win32 [5], somewhat old but with many advanced topics well covered.


[+1] [2008-08-20 13:55:47] AlexCuse

All you really need is the Python site [1].

The little IDE they have (I think it's called Python interactive? edit- it's IDLE - thanks @Baltimark) is pretty good. Basically a text editor that you can execute code in. I am a big fan of learning any new language in a text editor so that you don't get spoiled by the little things the IDE does automagically for you.

The docs on the website are pretty good for teaching too, you could start here [2].


[+1] [2008-09-27 07:44:09] crystalattice

Best Tool: SPE [1]. It's cross-platform, includes many handy tools, and has wxGlade built-in so you can quickly make graphical programs if you want

Best Book: I'm partial to Python, How to Program [2] from Deitel Publishing. Though it's old (uses Python v2.2) it is written as a college textbook so not only is it pretty comprehensive, it also includes a lot of quizes and tests to help you learn. A second edition is supposed to be coming out next January. Learning Python [3] from O'Reilly is also a great book, covering a lot more "esoteric" topics that you would expect in a computer science course.

Best Website: I would have to plug the tutorial [4] that I wrote a few years ago. It may not be the best but it was selected for use as a college introductory course. Beyond that, the website and Dive into Python are natural picks.

Best Problem Domain to do a sample project: Scratch an itch. I learned Python to make a game. Find something you are interested in creating and just do it. Make a simple web browser, create a database to track your car's gas mileage, or maybe ask friends or family if there is something they would like you to make for them.


[+1] [2010-04-13 06:44:32] Suvir

A couple of great options ...

  1. PyCrust - it's a great Python shell with code completion and debugger.
  2. If you are looking for a more intermediate-level book, I would suggest Thinking in Python [1] by Bruce Eckel. It covers advanced topics like design patterns which really help improve your understanding of Python.
  3. This is a bit off-topic, but gets me excited, and obviously teaches you more about Python itself: try out alternative implementations like IronPython [2] and Jython [3]. You can use them to explore other frameworks like .NET and Java and retain the zen of Python..

[+1] [2010-12-29 23:30:13] Samet Atdag

You can find from simple to hard Python questions (and its solutions) in CodingBat Python Questions/Answers 1 [1] and CodingBat Python Questions/Answers 2 [2] documents. I have taken all questions from CodingBat. There are simple questions, normal questions and hard questions. But all of them are good questions.

[2] - starcorn