擅长:python、mysql、java
<p>从你发布的内容看不出发生了什么,但是这个错误很常见。在实际代码的某个地方,您正试图连接(或添加)一个字符串和一个列表。问题出现在这里:</p>
<pre><code>File "fmcrawler_sql.py", line 211, in write_fights_to_database
fightId = hash(bothFighters+fight['Event'])
TypeError: cannot concatenate 'str' and 'list' objects
</code></pre>
<p>我猜<code>bothFighters</code>是一个列表,<code>fight['Event']</code>是一个字符串。将字符串更改为列表,错误可能会消失。(Python允许您一起“添加”列表,用两个列表的第一级条目创建一个较长的列表)。你知道吗</p>
<p>如果仍然需要帮助,请使用代码进行更新。你知道吗</p>
<hr/>
<p><a href="https://stackoverflow.com/questions/1720421/how-to-append-list-to-second-list-concatenate-lists">List concatenation in Python</a></p>
<p><a href="http://www.pythonforbeginners.com/concatenation/string-concatenation-and-formatting-in-python" rel="nofollow noreferrer">String concatenation basics if you ever need 'em.</a></p>
<hr/>