上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页
摘要: 递归实现 while循环实现 while+yield实现 实现迭代器协议 ***** 迭代器协议:必须具有 __next__ 和 __iter__ 方法 可迭代对象有 __iter__ 方法,执行__iter__方法得到的就是迭代器 阅读全文
posted @ 2018-01-12 20:27 lixin[at]hitwh 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 闭包参考:http://blog.csdn.net/marty_fu/article/details/7679297 装饰器参考1:https://segmentfault.com/a/1190000007321935 ***** 装饰器参考2:http://blog.csdn.net/dreamc 阅读全文
posted @ 2018-01-12 00:46 lixin[at]hitwh 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 2018-01-03@望京 排序,立即想到用Python的内置函数sorted() 字典按key排序 字典是无序的,对字典排序本身是一个没有太大意义的事,但是面试的时候总会遇到=='' 那么问题来了,如何对字典按照value排序呢(默认是对key进行排序)? 首先需要知道sorted()这个函数的几 阅读全文
posted @ 2018-01-11 20:38 lixin[at]hitwh 阅读(584) 评论(0) 推荐(0) 编辑
摘要: 2018-01-03@望京 关于列表切片的注意事项 补充示例1 用切片来删除序列里的某一段 列表反转 关于字符串切片注意事项(不同于列表) 切片实现字符串反转 递归实现字符串反转 赋值在字符串和列表中的区别 ***** 阅读全文
posted @ 2018-01-11 16:28 lixin[at]hitwh 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 2018-01-03 @望京 示例1 为什么不是输出 0~4? late-binding-closures in Python http://docs.python-guide.org/en/latest/writing/gotchas/#late-binding-closures 怎么修改使之输出 阅读全文
posted @ 2018-01-10 21:29 lixin[at]hitwh 阅读(590) 评论(0) 推荐(0) 编辑
摘要: 问题:https://stackoverflow.com/questions/8640367/python-manager-dict-in-multiprocessing 使用 multiprocessing.Manager 来实现IPC的时候,遇到的问题 示例1 示例2 为什么没有append成功 阅读全文
posted @ 2018-01-10 20:32 lixin[at]hitwh 阅读(3997) 评论(0) 推荐(0) 编辑
摘要: Python单例模式 Python基于线程安全的单例模式 惰性初始化 参考:https://www.cnblogs.com/xybaby/p/6425735.html 单例模式的实现一般都有两种方式: 要么在调用之前就创建好单例对象(eager way),要么在第一次调用的时候生成单例对象(lazy 阅读全文
posted @ 2018-01-03 00:42 lixin[at]hitwh 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 摘自:http.lua 阅读全文
posted @ 2017-11-22 18:04 lixin[at]hitwh 阅读(433) 评论(0) 推荐(0) 编辑
摘要: 参考:Lua中的协同程序 coroutine http.lua 协同程序(Coroutine): 三个状态:suspended(挂起,协同刚创建完成时或者yield之后)、running(运行)、dead(函数走完后的状态,这时候不能再重新resume)。 coroutine.create(arg) 阅读全文
posted @ 2017-11-22 17:33 lixin[at]hitwh 阅读(418) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python2.7 # -*- coding:utf-8 -*- """ 12306自动登录: - 先校验验证码 - 再校验用户名密码 """ import ssl import json import urllib import urllib2 import cookielib # 用来保存cookie c = cookielib.LWPCookie... 阅读全文
posted @ 2017-11-18 22:57 lixin[at]hitwh 阅读(1705) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 18 下一页