Start ipython running a script

后端 未结 7 948
暖寄归人
暖寄归人 2020-12-08 19:09

My use case is I want to initialize some functions in a file and then start up ipython with those functions defined. Is there any way to do something like

i         


        
7条回答
  •  一生所求
    2020-12-08 19:10

    You seem to be looking for ipyhton's %run magic command.

    By typing in ipython:

        %run hello_world.py
    

    you'll run the hello.py program saved in your home directory. The functions and variables defined in that script will be accessible to you too.

提交回复
热议问题