About 597,000 results
Open links in new tab
  1. python - How do I terminate a script? - Stack Overflow

    Sep 16, 2008 · (Note: using exceptions for exits is a python practical work-around for C/C++/Java devs always inappropriately calling exit-- hence python programmers may not notice the …

  2. python - What does end=' ' in a print call exactly do ... - Stack …

    Jul 16, 2023 · By default there is a newline character appended to the item being printed (end='\n'), and end='' is used to make it printed on the same line. And print() prints an empty …

  3. Terminating a Python Program - Stack Overflow

    +1 on using a return statement instead. Using a return statement (with or without a return value) means that your python program can be used from within an interactive session, or as part of …

  4. How do I abort the execution of a Python script? [duplicate]

    Jan 26, 2010 · Prints "aa! errors!" and exits with a status code of 1. There is also an _exit() function in the os module. The sys.exit() function raises a SystemExit exception to exit the …

  5. Programmatically stop execution of python script? [duplicate]

    The Python library reference explicitly states that those functions should only be used in the interactive interpreter and not in programs. – alldayremix Commented Feb 23, 2013 at 19:54

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

    Nov 5, 2013 · While the previous answers are helpful, they don't always work in all situations. If you have a Python-CV window open, which is waiting for a key press to quit, while running …

  7. python - How to exit an if clause - Stack Overflow

    def func1(a): if a > 100: # some code, what you want to do return a*a if a < 100: # some code, what you want to do return a-50 if a == 100: # some code, what you want to do return a+a If …

  8. python - Meaning of end='' in the statement print ("\t",end ...

    The default value of end is \n meaning that after the print statement it will print a new line. So simply stated end is what you want to be printed after the print statement has been executed. …

  9. exit - Best way to quit a python programme? - Stack Overflow

    Apr 22, 2018 · # import whatever other modules you want to use import some_module # define functions you will use def check_file(filename, phrase): with open filename as f: while True: # …

  10. How do I stop a program when an exception is raised in Python?

    Jan 13, 2009 · @kramer65: A program exit code of 0 means "finished without errors". Since the sys.exit call appears to be caused by an error, it should yield a program exit code that is not 0. …

Refresh