Is there a way to make python become interactive in the middle of a script?

后端 未结 6 986
执笔经年
执笔经年 2021-02-01 07:03

I\'d like to do something like:

do lots of stuff to prepare a good environement
become_interactive
#wait for Ctrl-D
automatically clean up

Is i

6条回答
  •  野性不改
    2021-02-01 08:06

    You may call python itself:

    import subprocess
    
    print "Hola"
    
    subprocess.call(["python"],shell=True)
    
    print "Adios"
    

提交回复
热议问题