2017年9月5日

摘要: 常见的三种格式: 第三种是 iso8859-1 遇到乱码时可 将前面加u 后 .encode('iso8859-1') .encode('iso8859-1') 阅读全文
posted @ 2017-09-05 16:14 姜维天 阅读(49) 评论(0) 推荐(0) 编辑

2017年7月12日

摘要: git feature 默认情况下,git fetch取回所有分支(branch)的更新 拉分支 阅读全文
posted @ 2017-07-12 15:30 姜维天 阅读(57) 评论(0) 推荐(0) 编辑

2017年7月7日

摘要: 子类不重写__init__,实例化子类时,会自动调用父类定义的__init__ 但是 子类重写__init__,实例化子类时,不会自动调用父类定义的__init__ 这种情况下可以显式的调用父类的Init方法: super(B, self).__init__(name) 阅读全文
posted @ 2017-07-07 17:14 姜维天 阅读(103) 评论(0) 推荐(0) 编辑

2017年6月22日

摘要: python中try/except/else/finally语句的完整格式如下所示: try: Normal execution block except A: Exception A handle except B: Exception B handle except: Other excepti 阅读全文
posted @ 2017-06-22 15:41 姜维天 阅读(15005) 评论(0) 推荐(1) 编辑

2017年6月16日

摘要: import sysprint sys.getdefaultencoding()这样可以获取系统默认的编码 (一般为ascii) import sysreload(sys)sys.setdefaultencoding("utf8") 之所以要reload(sys), 是因为python程序加载的时候 阅读全文
posted @ 2017-06-16 11:30 姜维天 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 查看跳转后的url : res.url 就可以了 查看跳转历史: res.history 阅读全文
posted @ 2017-06-16 11:17 姜维天 阅读(57) 评论(0) 推荐(0) 编辑

2017年6月7日

摘要: * yield用法 :yield类似于return 但是返回的是生成器,等下次继续调用def doit() for i in range(3): yield(i+6) for k in doit(): print k 返回: 9 10 11 阅读全文
posted @ 2017-06-07 14:47 姜维天 阅读(47) 评论(0) 推荐(0) 编辑

2017年5月20日

摘要: 1 selector.xpah("//*[@id='df']") // 后面的* 所有的元素 2 call_form = selector.xpath("//*[@id='details_table']/tbody/tr") 选取这个tbody下的所有的tr 3 selector.xpah("//* 阅读全文
posted @ 2017-05-20 18:14 姜维天 阅读(93) 评论(0) 推荐(0) 编辑

2017年5月16日

摘要: ' '.join(list) 将一个列表转换成字符串,中间以空格分隔 阅读全文
posted @ 2017-05-16 20:36 姜维天 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 增加: db.xx.insert(....) db.xx.save(....) 改: db.xx.update(......) 查: db.xx.find() 查集合中所有的 (.pretty())可以更美观 db.xx.find({'age':8,'name':'df'}) 删: db.xx.re 阅读全文
posted @ 2017-05-16 20:18 姜维天 阅读(82) 评论(0) 推荐(0) 编辑

导航