擅长:python、mysql、java
<p>正如<a href="https://stackoverflow.com/users/3000206/carcigenicate">@carcigenicate</a>指出的<a href="https://stackoverflow.com/a/58360314/3091398">here</a>建议使用元组列表而不是元组的元组。你知道吗</p>
<p>如<a href="https://stackoverflow.com/a/3523128/3091398">here</a>所示。如果您特别需要创建一个元组的元组,那么只需要使用下面的代码。你知道吗</p>
<pre><code>big_tup = ()
for i in range(2):
tup = (1, 2, 3)
big_tup += (tup,) # this doesn't insert tup to big_tup, it is actually creating a new tuple and with the existing tuples and new tup using the same name
print(big_tup)
# ((1, 2, 3), (1, 2, 3))
</code></pre>
<p>在行动中看到它<a href="https://repl.it/repls/FlashyFearlessRay" rel="nofollow noreferrer">here</a></p>