V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
tianzeteam
V2EX  ›  Python

关于 flask 返回字符串的问题

  •  
  •   tianzeteam · Dec 28, 2019 · 4823 views
    This topic created in 2314 days ago, the information mentioned may be changed or developed.
    flask 正常情况下,会返回 response 对象,目前有个需求是返回纯粹的字符串,这个怎么才能做到的
    2 replies    2019-12-29 08:17:45 +08:00
    whoami9894
        1
    whoami9894  
       Dec 28, 2019
    直接`return 'string'`就行啊,动态类型,框架都帮你做好了
    JQM
        2
    JQM  
       Dec 29, 2019 via iPhone
    不返回 response 怎么发出去?看下源代码里面对 wsgi 的调用
    我只知道可以把 content-type 改成 text/plain
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1448 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 92ms · UTC 16:55 · PVG 00:55 · LAX 09:55 · JFK 12:55
    ♥ Do have faith in what you're doing.