擅长:python、mysql、java
<p>我相信您要做的是将您显示的视图代码的第一行更改为:</p>
<p><code>template_vars['kural'] = thirukural[x].encode('ascii', 'xmlcharrefreplace')
</code></p>
<p>这应该会将所有内容都转换为HTML实体,结果会是这样的:</p>
<p><code>'&#2953;&#2994;&#2965;&#2990;&#3021; &#2980;&#2996;&#3008;&#2951;&#2991; &#2980;&#3018;&#2975;&#3021;&#2986;&#2990;&#3021; &#2990;&#2994;&#2992;&#3021;&#2980;&#2994;&#3009;&#2990;&#3021;\n\n&#2965;&#3010;&#2990;&#3021;&#2986;&#2994;&#3009;&#2990;&#3021; &#2951;&#2994;&#3021;&#2994; &#2980;&#2993;&#3007;&#2997;&#3009;.'
</code></p>