PrettyTable 这个怎么输出到 django 的网页上?

2017 年 7 月 3 日
 1002149271

查了半天,还是不会。。

2434 次点击
所在节点    Python
5 条回复
bearqq
2017 年 7 月 3 日
搜 django html 表格,忘掉 prettytable
ToughGuy
2017 年 7 月 3 日
content = PrettyTable.whatever()
return HttpResponse('<pre>{}</pre>'.format(content))

不过需求很奇葩哈, 既然是 html 为啥不直接用 table
1002149271
2017 年 7 月 4 日
@ToughGuy PrettyTable.whatever() 这个是什么意思
1002149271
2017 年 7 月 4 日
@ToughGuy 我怎么通过 django 在网页调用我这个 python 脚本的输出,我看好像只有通过 view 写响应函数,难道把所有程序移到 view 里面?
1002149271
2017 年 7 月 4 日
@ToughGuy PrettyTable.whatever() 这个是怎么用的,前面那个 PrettyTable 是定义的变量吗?为什么我用了这个网页显示 whtever 这个值是错的
Exception Type: AttributeError
Exception Value: whatever

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/372716

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX