小编B.O*_*ama的帖子

为什么以下声明不相同?

我以为我定义了一个元组。幸运的是它工作了很长时间。在一个特定的点上,它坏了->发现它实际上不是元组。最后,我期望像这样的里面有1个字符串的元组 ("expected tuple")

令人困惑,请解释

if any(key in [tuple("expect tuple"), tuple(("expect tuple"),),("expect tuple")] for key in [(("expect tuple"),)]):
    print("same")
Run Code Online (Sandbox Code Playgroud)

python tuples

1
推荐指数
1
解决办法
40
查看次数

标签 统计

python ×1

tuples ×1