To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Getting started with Python

What Python is

As mentioned previously, Python is an interpreted language. It is designed for general purpose programming, meaning it can be used for both the web and software development.

To use Python, an interpreter is needed on the local machine. The latest interpreter can be found on the Python website here.

Writing Python

Python can be written with any text editor such as Notepad or Notepad++, gEdit, Bluefish or any other editor out there. As it is interpreted the program would need to be run using the Python interpreter.

To find out which version of Python is installed on the system the following command in a command terminal will return this:

Shell Script
python -V
    

When using Mac OS X or Linux and a bash terminal, the following will be useful for running the script.

Shell Script
python filename.py
    
Python does not require files have the .py file extension, but it helps organise a system to have this at the end (especially as modern operating systems have great search capabilities and finding .py files is easier this way.).

IDEs

An IDE or Integrated Development Environment is a piece of software that makes writing programs much easier. One feature that is commonplace with IDEs is suggestions (like IntelliSense in Visual Studio) that help complete lines of code. Another thing that a lot of IDEs offer is debugging software. This will abolish the need to compile from the terminal.

An IDE is a great idea for beginner programmers and advanced ones too, but colouring is a must for any organised programmer, and most IDEs offer this by default.

Suggested IDEs

There are many IDEs out there that support Python syntax and compiling and the majority of the big IDEs support it out of the box. One such IDE is Aptana Studio as pictured.

Aptana Studio 3

Aptana Studio 3

Another particularly popular IDE for Python development is PyDev.

An alternative to using a full IDE is to have the command line ready and a simple text editor. Some text editors such as Atom (which I use for everything pretty much) offer syntax highlighting for Python which makes it harder to make mistakes.

Atom is a particularly good text editor for this purpose because if you install platformio-ide-terminal you can have the command line there are at all times:

Atom

Atom text editor with Python syntax highlighting

Provide feedback on this page
Comments are sent via email to me.