learn python the hard way(笨办法学python) 练习50
来源:互联网 发布:java获取所有interface 编辑:程序博客网 时间:2024/06/05 19:30
在运行web程序时,我们可能会遇到如下错误:
UnicodeDecodeError: ascii codec can t decode byte 0xe0
我们需要将书中的程序改成如下:
import sys
reload(sys)sys.setdefaultencoding('utf8')
import sys
reload(sys)
sys.setdefaultencoding('gb18030')
import web
urls = (
'/', 'index'
)
app = web.application(urls, globals())
class index:
def GET(self):
greeting = "Hello World"
return greeting
if __name__ == "__main__":
app.run()
成功运行后,显示:
http://0.0.0.0:8080/
0 0
- learn python the hard way(笨办法学python) 练习50
- learn python the hard way(笨办法学python) 练习32 附加练习
- learn python the hard way(笨办法学python) 练习38 附加练习
- 笨办法学 Python (Learn Python The Hard Way)
- learn python the hard way(笨办法学python) 练习40 类的用法
- learn python the hard way(笨办法学python) 练习10
- learn python the hard way(笨办法学python) 练习39
- learn python the hard way(笨办法学python) 练习46
- learn python the hard way(笨办法学python) 附录 个人整理
- learn python the hard way(笨办法学python) 习题22
- 笨办法学 Python (Learn Python The Hard Way)——003
- Learn Python the Hard Way(“笨办法”学python) 第四版 例39笔记
- 第一本计算机书—笨办法学 Python (Learn Python The Hard Way)
- Learn Python The Hard Way-笨方法学Python
- 跟着《Learn Python The Hard Way》学Python(一)
- 跟着《Learn Python The Hard Way》学Python(二)
- 学《learn python the hard way》(3)
- 学《learn python the hard way》(1)
- Java +spring MVC 后台图片流在前台页面显示
- SonarQube EXECUTION FAILURE
- php 文件操作
- Android EventBus 3.0 框架
- iOS开发 automaticallyAdjustsScrollViewInsets 属性设置
- learn python the hard way(笨办法学python) 练习50
- 《编写高质量iOS与OS X代码的52个有效方法》之第二章要点
- mongodb 日志过大
- 第四届_连号区间数
- android并发网络请求的处理
- html5 indexDB
- 如何在Xib中设置Button的属性(圆角以及背景颜色)
- 汇编学习笔记之寄存器综述
- jsp 编辑word:jsp word编辑 文件传输错误,请检查你的网络