Is there a possibility to execute a Python script while being in interactive mode

后端 未结 6 1265
再見小時候
再見小時候 2020-12-23 09:10

Normally you can execute a Python script for example: python myscript.py, but if you are in the interactive mode, how is it possible to execute a Python script

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 09:53

    You might want to look into IPython, a more powerful interactive shell. It has various "magic" commands including %run script.py (which, of course, runs the script and leaves any variables it defined for you to examine).

提交回复
热议问题