会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
程序猿Xiaohen
https://www.gitbook.com/@huangxiaohen2738
博客园
首页
新随笔
联系
管理
上一页
1
2
3
4
5
6
7
下一页
2014年7月19日
初始twisted(一)
摘要: 1.与同步模型的优势: 1.有大量的任务,一个时刻内至少有一个任务要运行 2.任务执行大量的I/O,同步模型会因为任务阻塞而浪费大量时间 3.任务之间相互独立,任务内部交互少.2.与同步模式客户端的差别: 1.异步模式会一次性与全部服务器完成连接,而不是同步模式那样一次连接一...
阅读全文
posted @ 2014-07-19 20:26 huangxiaohen
阅读(246)
评论(0)
推荐(0)
2014年7月16日
python 生成二维码
摘要: #coding:utf8try: import qrcodeexcept ImportError: qrcode = Noneclass MakeQr: def onUseQrcode(self, value): qr = qrcode.QRCode(version=1,...
阅读全文
posted @ 2014-07-16 11:58 huangxiaohen
阅读(629)
评论(0)
推荐(1)
2014年7月15日
python中的各种排序
摘要: #encoding=utf-8import randomfrom copy import copy def directInsertSort(seq): """ 直接插入排序 """ size = len(seq) for i in range(1,size): t...
阅读全文
posted @ 2014-07-15 20:25 huangxiaohen
阅读(482)
评论(0)
推荐(0)
python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
摘要: import sys class Stats: def __init__(self, sequence): # sequence of numbers we will process # convert all items to floats for numeri...
阅读全文
posted @ 2014-07-15 20:22 huangxiaohen
阅读(59203)
评论(1)
推荐(0)
2014年7月13日
python中的lambda
摘要: lambda表达式返回一个函数对象例子:func = lambda x,y:x+yfunc相当于下面这个函数def func(x,y): return x+y 注意def是语句而lambda是表达式下面这种情况下就只能用lambda而不能用def[(lambda x:x*x)(x) for x...
阅读全文
posted @ 2014-07-13 20:57 huangxiaohen
阅读(508)
评论(0)
推荐(0)
python中有趣的函数
摘要: filter(function, sequence):对sequence中的item依次执行function(item),将执行结果为True的item组成一个List/String/Tuple(取决于sequence的类型)返回:>>> def f(x): return x % 2 != 0 an...
阅读全文
posted @ 2014-07-13 20:50 huangxiaohen
阅读(751)
评论(0)
推荐(0)
2014年7月12日
python中的小技巧
摘要: 1.求1~100以内的素数prime=filter(lambda x: not [x%i for i in range(2,x) if x%i==0], range(2,101))#列表推导,一行搞定.print prime2.求字符串子串s='hauifnefldmfp'[s[i:i+n] for...
阅读全文
posted @ 2014-07-12 20:35 huangxiaohen
阅读(315)
评论(0)
推荐(0)
2014年7月9日
python 删除list中重复元素
摘要: list = [1,1,3,4,6,3,7] 1.for s in list: if list.count(s) >1: list.remove(s) 2.list2=[]for s in list: if s not in list2: list2.ap...
阅读全文
posted @ 2014-07-09 17:44 huangxiaohen
阅读(1550)
评论(0)
推荐(0)
2014年7月5日
django-pagination的使用
摘要: 1.安装django-pagination2.将文件夹pagination复制到项目的根目录下3.修改settings: 1.将'pagination.middleware.PaginationMiddleware', 添加到MIDDLEWARE_CLASSES中。 2.app添加 'pagi...
阅读全文
posted @ 2014-07-05 17:22 huangxiaohen
阅读(304)
评论(0)
推荐(0)
2014年6月30日
django-south
摘要: python manage.py schemamigration youappname --initial # --initial在数据库创建models定义的表,以及South需要的south_migrationhistory表,另外会在youappname目录下面创建一个migratio...
阅读全文
posted @ 2014-06-30 11:20 huangxiaohen
阅读(334)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
下一页
公告