Pause in Python

后端 未结 13 1277
臣服心动
臣服心动 2020-12-24 10:59

I am running command-line Python scripts from the Windows taskbar by having a shortcut pointing to the Python interpreter with the actual script as a parameter.

Afte

13条回答
  •  鱼传尺愫
    2020-12-24 11:21

    Yes, I know I'm posting to an old thread but I'd like to add my vote for using input() (3.x and up).

    Added to the end of my .py script, it indeed prevents the console window from opening and immediately closing.

    As to the "problem" of what key to press to close it, I (and 1,000's of others, I'm sure) simply use input("Press Enter to close").

    Thanks for letting me add my 2 cents worth :)

    .

提交回复
热议问题