gpt4 book ai didi

python - True 和 [] 的输出

转载 作者:太空狗 更新时间:2023-10-29 18:20:42 25 4
gpt4 key购买 nike

我想知道为什么
True 和 []
返回 [] 而不是 False

表达式是语法糖吗?

最佳答案

答案可在 5.10. Boolean Expressions 找到:

The expression x and y first evaluates x; if x is false, its value is returned; otherwise, y is evaluated and the resulting value is returned.

关于python - True 和 [] 的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8816736/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com