Python – IDLE
IDLE (Integrated Development and Learning Environment) is an integrated development environment (IDE) for Python.
The Python installer for Windows contains the IDLE module by default.
IDLE is not available by default in Python distributions for Linux. It needs to be installed using the respective package managers. For example, in case of Ubuntu:
$ sudo apt-get install idle
IDLE can be used to execute a single statement just like Python Shell and also to create, modify and execute Python scripts.
IDLE provides a fully-featured text editor to create Python scripts that includes features like syntax highlighting, autocompletion and smart indent.
It also has a debugger with stepping and breakpoints features.
To start IDLE interactive shell, search for the IDLE icon in the start menu and double click on it.
This will open IDLE, where you can write Python code and execute it as shown below.
Now, you can execute Python statements same as in Python Shell as shown below.
To execute a Python script, create a new file by selecting File -> New File from the menu.
Enter multiple statements and save the file with extension .py using File -> Save. For example, save the following code as hello.py
.
Now, press F5 to run the script in the editor window. The IDLE shell will show the output.
Thus, it is easy to write, test and run Python scripts in IDLE.