web.py输出中文字符串乱码问题的解决

web.py中文字符串网页显示乱码的解决

#!/usr/bin/env python  
# encoding: utf-8
import web
urls = (
'/', 'index'
)
class index:
def GET(self):
web.header('Content-Type', 'text/html;charset=UTF-8')
return "<h1>你好!</h1>"
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()
posted @ 2018-06-13 10:15  公众号python学习开发  阅读(2208)  评论(0编辑  收藏  举报