Create console in python

I am looking to have the same functionality (history, ...) that when you simply enter python into your terminal. script I have a bunch of installation code, and when it is ready, the user must have a command line. What would be the best way to achieve this?

+3
source share
2 answers

Run the script from the console using python -i. It will go through the commands and drop you into the regular Python console when this is done.

+6
source

Use readlineand code the shell behavior yourself, or just prepare your environment and go to IPython.

+9
source

Source: https://habr.com/ru/post/1764616/


All Articles