擅长:python、mysql、java
<p>我希望在这里提供更多的背景知识。</p>
<p>首先,方法<a href="https://docs.python.org/3/library/threading.html#threading.Thread" rel="nofollow noreferrer">threading::Thread</a>的构造函数签名:</p>
<pre><code>class threading.Thread(group=None, target=None, name=None, args=(), kwargs={}, *, daemon=None)
</code></pre>
<blockquote>
<p><strong><em>args</em></strong> is the argument <strong><em>tuple</em></strong> for the target invocation. Defaults to ().</p>
</blockquote>
<p>其次,Python中关于<code>tuple</code>的<a href="https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences" rel="nofollow noreferrer">quirk</a>:</p>
<blockquote>
<p>Empty tuples are constructed by an empty pair of parentheses; <strong><em>a tuple with one item</em></strong> is constructed by following a value with a <strong><em>comma</em></strong> (it is not sufficient to enclose a single value in parentheses).</p>
</blockquote>
<p>另一方面,字符串是字符序列,如<code>'abc'[1] == 'b'</code>。因此,如果向<code>args</code>发送一个字符串,即使在括号中(仍然是一个sting),每个字符都将被视为一个参数。</p>
<p>然而,Python是如此的集成,不像JavaScript那样可以容忍额外的参数。相反,它抛出一个<code>TypeError</code>来抱怨。</p>