Have you just started learning Python? Yes? No? If Yes, then you must have been introduced to IDLE while learning about python programming. Below down we have a few Tips, Tricks, and Shortcuts, which will make your life a little easy while learning and executing python code on IDLE. If No, then you must be interested in learning python, or in learning more about IDLE.

Nevertheless, let's begin.

TAB Completion

Type any alphabet in the IDLE and hit TAB key, and the TAB completion is here to help you. A drop-down window will appear with all the possible options available.

Copy the Line

Put the cursor on any line and hit Enter key. This will copy the line. And you can Paste it anywhere you want. This is an amazing way to copy lines of code to share on some other window, for example, paste in a text editor.

Running commands from history

Press ALT + P, to see the last run command. You can press ALT + P multiple times to trace back any command in history. To come back to recent history, either press Delete key which will exit you from history or press ALT + N to see the next history command.

Exit from IDLE

Press CTRL + Q to exit. This will close all the open windows and quit IDLE, but it will ask the user to save his/her code if unsaved.

Close the Active Window

Press ALT + F4 to close the current window.

Save the Code

CTRL + S will save the code of the current window to the associated file.

Find and Replace

To look for any word in the IDLE window, press CTRL + F to find. You can also use the Find and Replace option to directly replace the word, if required, use shortcut CTRL + H to do so.

Find Subsequent Code

If you have already used CTRL + F to find a word or a string or a variable in your code and want to look for the next occurrence of the same word, string or variable, then just press F3 and keep on pressing it to keep looking for more.

Run the Program

F5 for windows. Press F5 and the code in the current window will be compiled, interpreted and executed.

Need Help?

Press F1 to trigger Python Editor Context Help. This will display help related to the current action in the IDLE window. It is really helpful for beginners who love to explore.

Comment/UnComment

Select the code you want to comment and press ALT + C and whooosshh! its commented. To UnComment press ALT + U.

We hope these few shortcuts will help you while learning to code in Python using IDLE. And if you already know coding in Python and are here just to know more about IDLE, we hope we did not disappoint you.