![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
使用技巧
jackauyure
这个作者很懒,什么都没留下…
展开
-
执行完毕python之后进入交互模式
[code="python"]import codeinterp = code.InteractiveConsole(globals())interp.interact("")[/code]原创 2013-03-05 11:27:37 · 478 阅读 · 0 评论 -
[转]python迭代,yield使用
前段时间在读trac 中wiki模块的源码的时候,发现了很多地方都使用了yiled这一关键词,感觉是在需要返回某个值的地方通过yield来代替return,不是很明白其用法,所以仔细研究下。 一个使用了yiled关键字的函数就不再是一个普通的函数了,而是一个生成器函数(generator function),当函数被调用的时候将返回一个迭代器(iterato...原创 2013-03-05 11:40:02 · 89 阅读 · 0 评论 -
实现双向队列
[code="php"]class deque{ public $queue = array(); public $length = 0; public function rpop(){ $node = array_pop($this->queue); $this->countque(); return $node; } public func...原创 2013-03-12 16:12:05 · 118 阅读 · 0 评论 -
python内存释放原则
[code="python"]def getInit(class_name): """动态加载模块""" resultmodule = __import__(class_name, globals(), locals(), [class_name]) resultclass = getattr(resultmodule, class_name) retu...原创 2013-03-13 14:55:15 · 795 阅读 · 0 评论 -
批量KILL进程
[code="shell"]ps aux| grep datafenxi| grep -v grep| awk '{print $2}'| xargs kill -9[/code]ps aux 显示所有进程grep datafenxi 查询含有datafenxi的进程grep -v grep 去掉含有grep的进程awk '{print $2}' 输出第二列,就是p...原创 2013-03-14 17:00:53 · 188 阅读 · 0 评论