Fork me on GitHub
摘要: 脚本如下: 阅读全文
posted @ 2016-12-06 18:05 stefan.liu 阅读(425) 评论(0) 推荐(0) 编辑
摘要: MySQL-Sandbox 3.1.10 introduces a new utility, different from anything I have put before in the MySQL Sandbox toolkit. make_sandbox_from_url downloads 阅读全文
posted @ 2016-07-11 14:47 stefan.liu 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 超时函数 这个函数的作用在于可以给任意可能会hang住的函数添加超时功能,这个功能在编写外部API调用 、网络爬虫、数据库查询的时候特别有用 timeout装饰器的代码如下: 使用: Trace函数 有时候出于演示目的或者调试目的,我们需要程序运行的时候打印出每一步的运行顺序 和调用逻辑。类似写ba 阅读全文
posted @ 2016-07-06 11:33 stefan.liu 阅读(315) 评论(0) 推荐(0) 编辑
摘要: is will return True if two variables point to the same object, == if the objects referred to by the variables are equal.>>> a = [1, 2, 3] >>> b = a >>> b is a True >>> b == a True >>> b = a[:] >>> b ... 阅读全文
posted @ 2016-07-05 14:01 stefan.liu 阅读(182) 评论(0) 推荐(0) 编辑
摘要: MapReduce的设计灵感来自于函数式编程,这里不打算提MapReduce,就拿python中的map()函数来学习一下。 文档中的介绍在这里: map(function, iterable, ...) Apply function to every item of iterable and re 阅读全文
posted @ 2016-07-05 13:49 stefan.liu 阅读(693) 评论(0) 推荐(0) 编辑
摘要: 本文转载地址: http://cenalulu.github.io/python/gil-in-python/ GIL是什么 首先需要明确的一点是GIL并不是Python的特性,它是在实现Python解析器(CPython)时所引入的一个概念。就好比C++是一套语言(语法)标准,但是可以用不同的编译 阅读全文
posted @ 2016-06-27 18:01 stefan.liu 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 1.列表推导式书写形式: [表达式 for 变量 in 列表] 或者 [表达式 for 变量 in 列表 if 条件] 2.举例说明: 结果: 3.总结: Python的列表推导式通过for 语句处理表达式里面的变量,如果还要加条件,就加if条件就可以了。 阅读全文
posted @ 2016-06-11 23:04 stefan.liu 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 1.models下面添加权限控制信息: 2.配置别名关联的URL: 3.app下创建权限文件,根据配置的URL修改permissions.py: 4.前端配置别名url的a标签: 5.permission文件下添加装饰器: 6.将权限与限制关联,permission文件下: 7.在想要权限限制的方法 阅读全文
posted @ 2016-06-02 13:22 stefan.liu 阅读(737) 评论(0) 推荐(0) 编辑
摘要: form: 后端: 前端: 阅读全文
posted @ 2016-05-31 22:56 stefan.liu 阅读(6482) 评论(1) 推荐(0) 编辑
摘要: models.py views.py 前端页面: 阅读全文
posted @ 2016-05-16 18:07 stefan.liu 阅读(8399) 评论(0) 推荐(1) 编辑