小编Jus*_*n M的帖子

Python 中“&”和“and”有什么区别?

第一个代码给出了True但第二个代码给出了错误

类型错误:& 不支持的操作数类型:“str”和“int”

&Python 中and运算符有什么区别and?不是一样吗?

student = "Justin"
Run Code Online (Sandbox Code Playgroud)

第一个代码

print(student == "Justin" and 1 == 1)
Run Code Online (Sandbox Code Playgroud)

第二个代码

print(student == "Justin" & 1 == 1)
Run Code Online (Sandbox Code Playgroud)

python operator-keyword

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

operator-keyword ×1

python ×1