Python, Press Any Key To Exit

后端 未结 9 1287
渐次进展
渐次进展 2020-12-31 06:16

So, as the title says, I want a proper code to close my python script. So far, I\'ve used input(\'Press Any Key To Exit\'), but what that does, is generate a er

9条回答
  •  臣服心动
    2020-12-31 07:14

    If you are on windows then the cmd pause command should work, although it reads 'press any key to continue'

    import os
    os.system('pause')
    

    The linux alternative is read, a good description can be found here

提交回复
热议问题