gpt4 book ai didi

python - 为什么 (()) 等于 ()?

转载 作者:太空狗 更新时间:2023-10-29 21:16:57 29 4
gpt4 key购买 nike

>>> (()) == ()
True
>>> (())
()

最佳答案

() 是一个 0 元组。 (foo) 产生 foo 的值。因此,(()) 产生一个 0 元组。

来自 the tutorial :

; a tuple with one item is constructed by following a value with a comma (it is not sufficient to enclose a single value in parentheses).

关于python - 为什么 (()) 等于 ()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5361416/

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