擅长:python、mysql、java
<p>很可能是因为您将语句拆分为多行,所以它只突出显示了最后一行。</p>
<p>对实际问题的修正很可能会改变</p>
<pre><code>self.fields['question_' + question.id]
</code></pre>
<p>到</p>
<pre><code>self.fields['question_' + str(question.id)]
</code></pre>
<p>由于可以在Python解释器中快速测试,因此将字符串和数字添加在一起不起作用:</p>
<pre><code>>>> 'hi' + 6
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
'hi' + 6
TypeError: cannot concatenate 'str' and 'int' objects
>>> 'hi' + str(6)
'hi6'
</code></pre>