They do similar things, but they use different positions.
Constants added by the site module
... They are useful for the interactive interpreter shell and should not be used in programs.
Useful in the interactive interpreter shell and should never be used in a program
That is,
#myfile.py - Inside the Python file
import sys
exit()#NOT
sys.exit() #Done
$ python
Python 2.7.11 (default, Dec 5 2015, 14:44:53)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit() #Done
$
© 2024 OneMinuteCode. All rights reserved.