V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2019-12-28 17:15:04 +08:00 · 3994 次点击
    这是一个创建于 1578 天前的主题,其中的信息可能已经有所发展或是发生改变。
    flask 正常情况下,会返回 response 对象,目前有个需求是返回纯粹的字符串,这个怎么才能做到的
    2 条回复    2019-12-29 08:17:45 +08:00
    whoami9894
        1
    whoami9894  
       2019-12-28 17:37:35 +08:00
    直接`return 'string'`就行啊,动态类型,框架都帮你做好了
    JQM
        2
    JQM  
       2019-12-29 08:17:45 +08:00 via iPhone
    不返回 response 怎么发出去?看下源代码里面对 wsgi 的调用
    我只知道可以把 content-type 改成 text/plain
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3912 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 10:23 · PVG 18:23 · LAX 03:23 · JFK 06:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.