How to stop Python closing immediately when executed in Microsoft Windows

后端 未结 15 2222
北荒
北荒 2020-12-02 22:43

I have just started college and we are going to be using python. We really have done nothing so I have downloaded the program and done some print commands, and that\'s it.

15条回答
  •  日久生厌
    2020-12-02 23:22

    In Python 2.7 adding this to the end of my py file (if __name__ == '__main__':) works:

    closeInput = raw_input("Press ENTER to exit")
    print "Closing..."
    

提交回复
热议问题