Skip to content

[PyCharm] Introduction of Console、Terminal、Script、TODO

When we using PyCharm IDE for developing, we can divide PyCharm into 3 areas.

  1. Project directory, all of files of projects in here
  2. The file you opened
  3. Execution result and other tools

Today I want to record several commonly used tools in PyCharm:

  • Script
  • Console
  • Terminal
  • TODO

Script

We start with Script. In fact, it refers to the Python writing environment with a graphical interface. (area 2)

It is the largest area in the center, we can write Python program here. The back-end parser will automatically analyze whether there are misspellings, auto-complete, and detected the current packages, highlight … even suggest coding style.

After executing, the “Run” area will be displayed below, showing the results of our program execution.


Console

The Console tool can be found below.

Click on the Python Console below to see this screen. Those who have used Python’s native interactive interface should be familiar with it.

The syntax is entered after “>>>”. Conveniently, we can see the variable value we entered on the left. In this time, I entered an integer and a string.

As you can see:

The variable name and value can be seen on the right side, which is very useful when debug and test code.


Terminal

Terminal tool is just like the terminal we generally used, but it will be preset in the virtual environment of the project venv built by PyCharm. The most obvious difference is that the package installed by pip is different from the package local to the system.

For example, I set the two values a and b above, and now we print them out.

# -*- coding: utf-8 -*-
a = 10
b = 'test'
print(a)
print(b)



The we open the Terminal tool below, and we should see an interface like this.


We can enter the commands we want, such as:

Output:

You can see that we printed the result, the Terminal tool is very convenient for people who used to ordering like this, and it is also suitable when setting arguments.


TODO

TODO is a small feature, but it is also one of the tools below, so let’s introduce it here.

In programming, TODO often refers to the works we have to complete next. However, in the process of writing our projects, we often find that the code is too large and the required functions are too complicated and we can not find where we should add the new functions we want.

At this time, the TODO tool is useful.

We can add it to the code like this and prompt us want to do, and since this line is actually annotated, it will not affect the execution of the existing program.

Then if we open the TODO tool below, we can see this reminder:

After we clicking the TODO icon, we will automatically jump to the TODO comment position.

Leave a Reply