擅长:python、mysql、java
<p><code>for</code>循环迭代地将list <code>story</code>的元素替换成<code>x</code>变量,而<code>[]</code>list指令需要元素索引。这会导致错误。你知道吗</p>
<pre><code>l = ['a','b']
print l[0]
print l['a'] // type error
</code></pre>
<p><strong>编辑</strong>:我错过了故事不是由字符串组成的。这些更改可以完成以下任务:</p>
<pre><code>story = [str(x).replace("<p>","\n").replace("<\p>","") for x in story]
</code></pre>
<p><strong>注意</strong>:现在<code>story</code>由字符串组成,而不是标记。你知道吗</p>