problem

eryk sun eryksun at gmail.com
Thu Jan 14 16:39:12 EST 2016


On Thu, Jan 14, 2016 at 3:10 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Jan 15, 2016 at 6:01 AM, Irmen de Jong <irmen.NOSPAM at xs4all.nl> wrote:
>> Either put something like this at the end of your python scripts, to keep the console open:
>>
>> raw_input("press enter to exit...")
>
> Small qualification: This is 3.5, so you should use input instead of raw_input.
>
> input("Press enter to exit...")

You can also make the interpreter enter the REPL by setting
PYTHONINSPECT, which works for the current process since this gets
checked at exit.

    import os
    os.environ['PYTHONINSPECT'] = '1'

Or use subprocess.Popen to start a new cmd shell attached to the
current console:

    import subprocess
    subprocess.Popen('cmd.exe')



More information about the Python-list mailing list