为什么Python解释器返回<class 'type of the variable'>的type(_).
为什么解释器没有显示错误消息,_但是在它给出的其他特殊字符的情况下SyntaxError.
>>> type(_)
<class 'type'>
>>> type($)
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
在Python解释器中,_始终将最后提供的表达式的输出作为值.
>>> 1
1
>>> _
1
>>> 'foo'
'foo'
>>> _
'foo'
Run Code Online (Sandbox Code Playgroud)
请注意,_在是否在解释器中,它是一个有效的变量名称,这不是一个特殊字符.