How To Learn Python

Learning a new language requires understanding the rules and accent of that language. Even programming languages are no exception for this. In open source world, there are lots of uncluttered languages to get your work done quickly. Python is by far the most widely used language which can be used in scripting as well as stand alone applications. It is used by many open source applications and developers.

  1. Obtaining Python. The first step in learning Python is to download and install it. You can download Python from its official site. You can also install Activepython, if you have a windows machine. 

    If you are using windows: Download the installer and run the executable. This will install IDLE, Module docs, command-line Python and Python manuals.

    If you are using Linux UNIX: Please check your system to see if it has the Python environment installed already, if not try the CD/DVD of your distro or Download the sources then compile Python from the source. After successfully compiling Python, you can access it from IDLE or even from terminal.

  2. IDLE&command line. Once you've installed Python in any of your systems (Win or Linux) you will see Python interpreter as IDLE and in Command-line type. IDLE is a GUI interpreter for Python which lets you compile and run the program with a GUI interface. If you're a Windows user then you can find IDLE more easily than command-line.

    There are many text editors available for Python; you can use any of these to create Python files. Whenever you start IDLE, it starts in interactive mode. In interactive mode what you type is immediately run. You can try this by typing 1+2 -- the interpreter will respond with answer the 3. You can even write your whole program, then save the file with a .py extension. Once it is saved, the next step is to run the program by going to Run then Run Module.

    IDLE is the only tool you need if you want to learn to program quickly. If you can work around with command-line easily then you can work with Python in terminal or command prompt. You can create your program, then run it under Python command-line as Python To exit from the command-line you have to type import sys; sys.exit( ).

  3. Text processing. While you program with Python, you do most of the text processing. To get a good grip on Python, you have to work on basic programs. You have to make yourself comfortable with loops, functions, strings and lists before moving onto class, stack and files. After that try to get an overview of the kinds of classes involved in Python. Don't try to dig deep but make yourself familiar with the class and methods.
  4. GUI. Once you find yourself comfortable with the text processing. You might be interested in creating your own modules or the stand alone executable to distribute your application. If you are interested in creating stand alone applications then look for the installer command in the manual or download py2exe.To program GUI based applications you have many options, like Wxpython, Tkinter, Pyqt etc. Tkinter is a GUI widget set for Python. Wxpython is another GUI toolkit for the Python programming language which allows you to easily create graphical user interfaces.
  5. Learning more. Read some sample code; you will learn a lot from code written by others. You can get a lot of sample code from sites like sourceforge and activestate. There is lot of help available for Python. You can join Google Newsgroups or Python communities on orkut to learn more. You can even get your questions answered from orkut's Python communities.

    To get started in python you should read "Non-Programmers Tutorial for Python" then "How to think Like a Computer Scientist-Python version”, you will learn a lot from these resources. Then for further study you can read "Text Processing in Python" by David Mertz and "Python Programming on Win32" by Mark Hammond. Another good resource is "Core Python Programming" by Wesley Chun.

Reading and writing code is the only way you can make yourself a better programmer in any language. Python is very esy to learn, so have fun learning it.


Share this article!

Follow us!

Find more helpful articles:



The very basics--excellent for beginners! You should have put a "hello world" example, however... Phyton is the most friendly language I have ever seen ...

By Marcos Riso