小编Nic*_*cky的帖子

如何在bottlepy中呈现元组

我一直在使用bottlepy,我有这样的事情:

..code..
comments = [(u'34782439', 78438845, 6, u'hello im nick'), 
(u'34754554', 7843545, 5, u'hello im john'), 
(u'332432434', 785345545, 3, u'hello im phil')] 

return comments
Run Code Online (Sandbox Code Playgroud)

在视图中我做了这个:

%for address date user text in comments:
      <h3>{{address}}</h3>
      <h3>{{date}}</h3>
      <h3>{{user}}</h3>
      <h3>{{text}}</h3>
%end
Run Code Online (Sandbox Code Playgroud)

当我启动服务器时,错误是:

Error 500: Internal Server Error

Sorry, the requested URL http://localhost:8080/hello caused an error:

Unsupported response type: <type 'tuple'>
Run Code Online (Sandbox Code Playgroud)

我怎么能把它渲染到视图中?

(对不起我的英文)

python templates bottle

2
推荐指数
1
解决办法
1482
查看次数

标签 统计

bottle ×1

python ×1

templates ×1