我查看了类似的问题,但没有在任何地方找到这个主题。
我想知道元组 (1,) 在 Python 中是什么意思?
请您参考如下方法:
来自 https://wiki.python.org/moin/TupleSyntax
One Element Tuples
One-element tuples look like:
1,The essential element here is the trailing comma. As for any expression, parentheses are optional, so you may also write one-element tuples like
(1,)but it is the comma, not the parentheses, that define the tuple.
