当前位置: 首页 > news >正文

网站设计流程是wordpress底部居中

网站设计流程是,wordpress底部居中,wordpress asp,google网站管理员工具 下载本文转载自公众号“读芯术”(ID#xff1a;AI_Discovery)。写代码必然会出现错误#xff0c;而错误处理可以针对这些错误提前做好准备。通常出现错误时#xff0c;脚本会停止运行#xff0c;而有了错误处理#xff0c;脚本就可以继续运行。为此#xff0c;我们需要了解下…本文转载自公众号“读芯术”(IDAI_Discovery)。写代码必然会出现错误而错误处理可以针对这些错误提前做好准备。通常出现错误时脚本会停止运行而有了错误处理脚本就可以继续运行。为此我们需要了解下面三个关键词try这是要运行的代码块可能会产生错误。except如果在try块中出现错误将执行这段代码。finally不管出现什么错误都要执行这段代码。现在我们定义一个函数“summation”将两个数字相加。该函数运行正常。defsummation(num1,num2):print(num1num2)summation(2,3)5接下来我们让用户输入其中一个数字并运行该函数。num12num2input(Enter number: )Enter number: 3summation(num1,num2)print(Thisline will not be printed because of the error)---------------------------------------------------------------------------TypeError                                Traceback (most recent call last)in----1 summation(num1,num2)2 print(This line will notbe printed because of the error)in summation(num1, num2)1 def summation(num1,num2):----2     print(num1num2)TypeError: unsupported operand type(s) for :  int  and  str“TypeError”错误出现了因为我们试图将数字和字符串相加。请注意错误出现后后面的代码便不再执行。所以我们要用到上面提到的关键词确保即使出错脚本依旧运行。try:summed2  3except:print(Summation is not ofthe same type)Summation is not of the same type可以看到try块出现错误except块的代码开始运行并打印语句。接下来加入“else”块来应对没有错误出现的情况。try:summed2 3except:print(Summation is not ofthe same type)else:print(There was no errorand result is: ,summed)There was no error and result is:  5接下来我们用另外一个例子理解。这个例子中在except块我们还标明了错误类型。如果没有标明错误类型出现一切异常都会执行except块。try:fopen( test , w )f.write(This is a testfile)except TypeError:print(There is a typeerror)except OSError:print(There is an OSerror)finally:print(This will print evenif no error)This will print even if no error现在故意创造一个错误看看except块是否与finally块共同工作吧!try:fopen( test , r )f.write(This is a testfile)except TypeError:print(There is a typeerror)except OSError:print(There is an OSerror)finally:print(This will print evenif no error)There is an OS errorThis will print even if no error【责任编辑赵宁宁 TEL(010)68476606】点赞 0
http://www.yutouwan.com/news/13368/

相关文章:

  • 网站开发北京公司网站官网设计规范
  • 什么网站需要备案网站建设前 沟通内容
  • 南通做网站软件香水网站设计网页
  • dream网站怎么做框架用python做网站后台
  • 如何自己做网站站长wordpress网站关键字
  • 禅城区建设局网站百度订单售后电话
  • 青岛英文网站建设电商网站制作设计
  • 网站的设计方案wordpress和
  • 站内免费推广价格查询网
  • 无需注册网站模板下载上海网站开发孵化
  • 江西省住房和城乡建设厅的网站教做详情页的网站
  • 做网站能赚钱吗知乎wordpress导航字体大小
  • 要想提高网站排名应该如何做家具能在什么网站上做
  • 大连做网站 选领超科技网站建设合同要存档几年
  • 更改wordpress主题语言包南京百度快速排名优化
  • 晟合建设集团网站上海网站建设服务公司
  • 已备案个人网站做淘宝客动态图片在线制作
  • 网站开发前途长沙企业建站
  • 怀化组织部网站编程除了做网站还能干什么
  • 网站百度排名旅行社网站模板
  • 重庆网站制作长沙优化方案2021版语文答案
  • 江苏省实训基地建设网站网站分类查询
  • 水文站网站建设应当坚持单位网站建设费算无形资产吗
  • 招商网站办公家具 技术支持 东莞网站建设
  • 临沂建设质量监督站网站网站建设需要哪些常用技术
  • 抚松网站建设灵台门户网站建设
  • 有什么网站是专做婚礼素材的南京江宁网站制作
  • editplus怎么创网站电商运营网站设计
  • 医疗网站建设机构分类导航wordpress
  • 安徽做网站找谁怎么上传图片到公司网站