异常try...except
#!/usr/bin/python
# Filename: try_except.pyimport systry: s = raw_input('Enter something --> ')except EOFError: print '\nWhy did you do an EOF on me?' sys.exit() # exit the programexcept: print '\nSome error/exception occurred.' # here, we are not exiting the programprint 'Done'

浙公网安备 33010602011771号