Python中文
首页
教程
问答
标签
搜索
登录
注册
Python中SyntaxError不一致?
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>考虑以下两个片段:</p> <pre><code>try: a+a=a except SyntaxError: print "first exception caught" </code></pre> <p>一。在</p> ^{pr2}$ <p>在第二种情况下,打印“second exception..”语句(捕捉到异常),而在第一种情况下则不打印</p> <p>第一个异常(我们称之为“SyntaxError1”)和第二个异常(“SyntaxError2”)有什么不同吗?在</p> <p>有什么方法可以捕获SyntaxError1(从而消除编译时错误)?在<code>eval</code>中包装大代码块不令人满意;)</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>简而言之:不</p> <p>语法错误发生在代码被解析时,对于普通的Python代码来说,语法错误发生在代码执行之前-代码没有在try/except块内执行,因为代码没有执行,句点。在</p> <p>但是,当您评估或执行某些程式码时,您会在执行阶段解析它,所以您可以撷取例外状况。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
文本导入时标题行中的特殊字符
8 回答
文本小部件:在没有输入时更新并在循环后保持空闲
10 回答
文本小部件tkin
8 回答
文本小部件tkinter中的标签更改或文本外观更改是否有撤消功能?
5 回答
文本小部件tkinter复制图像选项
8 回答
文本小部件上的Python Tkinter ttk滚动条未缩放
9 回答
文本小部件上的滚动条可能需要根据制表符ord显示前进行滚动
6 回答
文本小部件不显示lis中的内容
3 回答
文本小部件不显示Unicode字符
9 回答
文本小部件中写入的行间距
7 回答
文本小部件中的文本作为变量
7 回答
文本小部件中的滚动条仅显示在底部
9 回答
文本小部件中的选项卡键空间计数
7 回答
文本小部件作为Lis
10 回答
文本小部件在主框架中扩展列宽
4 回答
文本小部件未使用删除功能清除
10 回答
文本小部件滚动动画(Tkinter、Python)
6 回答
文本居中。格式正确吗?
7 回答
文本差分算法
9 回答
文本已知时音频文件中的单词索引
2 回答