python web.py乱码怎么解决?
yang
2020-06-01 10:13:233996浏览 · 0收藏 · 0评论

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()更多Python知识请关注Python自学网
关注公众号,随时随地在线学习