About 47,800 results
Open links in new tab
  1. Exiting from python Command Line - Stack Overflow

    Mar 16, 2012 · To exit from Python command line, I have to type exit(). If I type exit, it says Use exit() or Ctrl-Z plus Return to exit Usually when you type exit, you would want to exit the program. Why does ...

  2. How to stop/terminate a python script from running?

    Nov 5, 2013 · To stop a python script just press Ctrl + C. Inside a script with exit(), you can do it. You can do it in an interactive script with just exit. You can use pkill -f name-of-the-python-script.

  3. How to exit Python script in Command Prompt? - Stack Overflow

    Jan 8, 2017 · On previous computers, when I would try to exit a Python script on the Windows command prompt, all you need to do is press ctrl+c. But when I do that on my computer it tells me "KeyboardInterr...

  4. Python in terminal: how to signify end of for loop?

    Say I want to print 0 through 9. I type in for i in range(10): print(i), press enter, and terminal shows ..., waiting for further statements. So I have to press enter again to have the numbers pr...

  5. python - How do I terminate a script? - Stack Overflow

    Sep 16, 2008 · Keep in mind that sys.exit(), exit(), quit(), and os._exit(0) kill the Python interpreter. Therefore, if it appears in a script called from another script by execfile(), it stops execution of both scripts.

  6. How to leave/exit/deactivate a Python virtualenv - Stack Overflow

    I had a curious situation where I couldn't deactivate, so solution wise I just closed the terminal in that situation. However, thanks for mentioning that explicitly naming the python venv also works.

  7. How to stop execution of python script in visual studio code?

    May 17, 2018 · However I want to stop the execution of the script so I have tried with Ctrl+C but the program is still running in the integrated terminal of Visual Studio Code.

  8. Python, Press Any Key To Exit - Stack Overflow

    Aug 9, 2012 · Note that on Python 3 raw_input was renamed to input. For users finding this question in search, who really want to be able to press any key to exit a prompt and not be restricted to using enter, you may consider to use a 3rd-party library for a cross-platform solution.

  9. Python exit commands - why so many and when should each be …

    Nov 3, 2013 · exit () is an alias for quit (or vice-versa). They exist together simply to make Python more user-friendly. Furthermore, it too gives a message when printed: >>> print (exit) Use exit () or Ctrl-Z plus Return to exit >>> However, like quit, exit is considered bad to use in production code and should be reserved for use in the interpreter.

  10. python - Doing something before program exit - Stack Overflow

    How can you have a function or something that will be executed before your program quits? I have a script that will be constantly running in the background, and I need it to save some data to a file