Exceptions cause your application to crash. Handling them allows you to recover gracefully and keep your application running. Learn how to handle exceptions, find what exceptions you should be handling, and exit gracefully in this lesson. You will also learn how you should not handle exceptions and when it is better to let your application crash rather than swallowing an exception.

import sys

# print(int(sys.argv[1]) / int(sys.argv[2]))

try:
print(int(sys.argv[1]) / int(sys.argv[2]))
except ValueError as e:
print('You must enter a valid number')
except ZeroDivisionError as e:
print("You can't divide by zero")

Built in: https://docs.python.org/3/library/exceptions.html#bltin-exceptions

Requests: http://docs.python-requests.org/en/master/_modules/requests/exceptions/

最新文章

  1. curl方法post一个数组
  2. java学习之协调同步的线程
  3. java邮件
  4. IOS 免受xib自动布局影响
  5. java web 学习十一(使用cookie进行会话管理)
  6. VOA学习-South Sudan Must Allow Aid
  7. 【HDOJ】1080 Human Gene Functions
  8. iOS模拟器分辨率的问题(转载)
  9. Android用surface直接显示yuv数据(二)
  10. 组队赛第二场:字符串哈希+DP
  11. SVN-钩子祥解与配置
  12. 中国大学MOOC-陈越、何钦铭-数据结构-2015秋 01-复杂度2 Maximum Subsequence Sum (25分)
  13. react native navigationOptions中不能获取this
  14. Navicat for Mysql导入mysql数据库脚本文件
  15. Problem A: STL——灵活的线性表
  16. Linux命令:popd
  17. contains用法
  18. 2018.09.29 Lua
  19. P1316 丢瓶盖(二分+贪心)
  20. react 使用 react-loadable分包

热门文章

  1. C# Hook
  2. SharePoint 第一个网站
  3. Ionic CLI升级到3版本后2版本工程运行出错.md
  4. html页面颜色名称和颜色值转换
  5. ivew语法中'${}`的用法
  6. Mac上vmware虚拟机Windows10安装Tomcat8.0及配置环境
  7. inceptionnet
  8. laravel中soapServer支持wsdl的例子
  9. POJ 3869 Headshot
  10. 怎样只接受固定长度数组为参数 & 数组形参