Skip to content

Commit 9c21be8

Browse files
committed
Handling exceptions
1 parent 9ed2f43 commit 9c21be8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

try_expect.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/python3.1
2+
# Filename: try_except.py
3+
4+
import sys
5+
6+
try:
7+
s = input('Enter something --> ')
8+
except EOFError:
9+
print('\nWhy did you do an EOF on me?')
10+
sys.exit()
11+
except:
12+
print('\nSome error/exception occurred.')
13+
14+
print('Done')

0 commit comments

Comments
 (0)