飞机场场长

本博客主要摘录python相关的知识,欢迎参阅。

导航

python----sys.exit()

python sys.exit()

 1 import sys
 2 
 3 try:
 4     s = raw_input('Enter something --> ')
 5 except EOFError:
 6     print '\nWhy did you do an EOF on me?'
 7     sys.exit() # exit the program
 8 except:
 9     print '\nSome error/exception occurred.'
10     # here, we are not exiting the program
11 
12 print 'Done' 
1 exit([status])
2 
3 Exit the interpreter by raising SystemExit(status).
4 If the status is omitted or None, it defaults to zero (i.e., success).
5 If the status is numeric, it will be used as the system exit status.
6 If it is another kind of object, it will be printed and the system
7 exit status will be one (i.e., failure).

posted on 2012-09-19 16:40  飞机场场长  阅读(484)  评论(0编辑  收藏  举报