推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
1002149271
V2EX  ›  Python

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

  •  
  •   1002149271 · Jul 3, 2017 · 2530 views
    This topic created in 3419 days ago, the information mentioned may be changed or developed.

    查了半天,还是不会。。

    5 replies  •  2017-07-04 20:29:14 +08:00
    bearqq
    bearqq
    Jul 3, 2017 via Android
    1
    搜 django html 表格,忘掉 prettytable
    ToughGuy
    ToughGuy
    Jul 3, 2017
    2
    content = PrettyTable.whatever()
    return HttpResponse('<pre>{}</pre>'.format(content))

    不过需求很奇葩哈, 既然是 html 为啥不直接用 table
    1002149271
    1002149271
    OP
    Jul 4, 2017
    3
    @ToughGuy PrettyTable.whatever() 这个是什么意思
    1002149271
    1002149271
    OP
    Jul 4, 2017
    4
    @ToughGuy 我怎么通过 django 在网页调用我这个 python 脚本的输出,我看好像只有通过 view 写响应函数,难道把所有程序移到 view 里面?
    1002149271
    1002149271
    OP
    Jul 4, 2017
    5
    @ToughGuy PrettyTable.whatever() 这个是怎么用的,前面那个 PrettyTable 是定义的变量吗?为什么我用了这个网页显示 whtever 这个值是错的
    Exception Type: AttributeError
    Exception Value: whatever
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1264 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:55 · PVG 07:55 · LAX 15:55 · JFK 18:55
    ♥ Do have faith in what you're doing.