Similar to matlab, you can directly operate variables on the console after the program is completed, instead of starting an independent console program. I wonder if any Python IDE supports this behavior
世界只因有你2017-07-05 11:06:10
Python’s own IDLE can do this. After you open a python file and run the module, you will find that you can control the variables in the file on the main console
I tried the Pycharm part myself, you go to Run/Edit Configurations...
Then add Interpreter options
to the options of -i
:
After running the script, the shell will keep and will not end there
In fact, you don’t need an IDE to do what you want
Suppose you have a python script test.py
a = 5
b = [1, 2, 3]
Use directly:
$ python -i test.py
Run test.py
After completion, Python will stop in the console and you can continue to interact
Or use:
$ python
After opening the python shell, use import
to import test and execute it. Then you can control the variable:
>>> from test import *
>>> a
5
>>> b
[1, 2, 3]
This also has the same effect
Questions I answered: Python-QA
伊谢尔伦2017-07-05 11:06:10
Compared with the native python shell, iPython is easier to use. In addition, after integrating Matplotlib, you can draw matlab-like graphics.