
❤️博客翻新中
try:
    text = input('Enter someting -->')
except EOFError:   # 按ctrl+D
    print('Why did you do an EOF on me?')
except KeyboardInterrupt: # 按ctrl+C
    print('You cancelled the operation.')
else:
    print('You enterd {}'.format(text))Enter someting -->^D
Why did you do an EOF on me?