摘要:
# -*-encoding:utf8-*-import reimport requestsimport sysreload(sys)sys.setdefaultencoding('utf8')class craw... 阅读全文
posted @ 2016-03-28 15:17
cn_wk
阅读(68)
评论(0)
推荐(0)
摘要:
今天做网页到了测试和数据库交互的地方,其中HTML和数据库都是设置成utf-8格式编码,插入到数据库中是正确的,但是当读取出来的时候就会出错,原因就是python的str默认是ascii编码,和unicode编码... 阅读全文
posted @ 2016-03-28 10:47
cn_wk
阅读(79)
评论(0)
推荐(0)
摘要:
脚本:#!/usr/bin/python dict={"a":"apple","b":"banana","o":"orange"} print "##########dict##################... 阅读全文
posted @ 2016-03-28 10:44
cn_wk
阅读(100)
评论(0)
推荐(0)
摘要:
现在大部分高级语言都支持“?”这个三元运算符(ternary operator),它对应的表达式如下:condition ? value if true : value if false。很奇怪的是,这么... 阅读全文
posted @ 2016-03-28 10:42
cn_wk
阅读(365)
评论(0)
推荐(0)