随笔分类 -  Python

摘要:# tests.pyimport sys,os,djangosys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) #把manage.py所在目录添加到系统目录os.environ.setdefault 阅读全文
posted @ 2018-01-10 16:06 懒惰的咕噜 阅读(335) 评论(0) 推荐(0)
摘要:数据结构 1. list a = [1, 2, 3] for i in a: if i > 2: a.insert(0, i) # a = 死循环 for i in a[:]: if i > 2: a.insert(0, i) # a = [3, 1, 2, 3] 控制流 1. for... 阅读全文
posted @ 2017-12-02 14:08 懒惰的咕噜 阅读(225) 评论(0) 推荐(0)
摘要:参数1. -c , -m, -i python test.py sys.argv = ['test.py'] python -c 'print "a"' sys.argv = ['-c'] python -m test sys.argv = ['/home/test.py'] python -i t 阅读全文
posted @ 2017-12-02 13:57 懒惰的咕噜 阅读(189) 评论(0) 推荐(0)
摘要:我遇到的情况是因为Unix Socket的原因 先查看下这个东东: 解决办法: Or Or, Add net.core.somaxconn=4096 to /etc/sysctl.conf for it to become permanent (survive the reboot). 最后在uws 阅读全文
posted @ 2017-10-10 16:18 懒惰的咕噜 阅读(2659) 评论(0) 推荐(0)
摘要:当时时间戳: 时区转换 时间戳转固定类型日期字符串: 阅读全文
posted @ 2017-04-13 10:07 懒惰的咕噜 阅读(340) 评论(0) 推荐(0)
摘要:200 OK - [GET]:服务器成功返回用户请求的数据,该操作是幂等的(Idempotent)。 201 CREATED - [POST/PUT/PATCH]:用户新建或修改数据成功。 202 Accepted - [*]:表示一个请求已经进入后台排队(异步任务) 204 NO CONTENT 阅读全文
posted @ 2017-03-20 14:21 懒惰的咕噜 阅读(139) 评论(0) 推荐(0)
摘要:"""内置函数""""""Number内置函数"""#类型转换int(x [,base ]) 将x转换为一个整数long(x [,base ]) 将x转换为一个长整数float(x ) 将x转换到一个浮点数complex(real [,imag ]) 创建一个复数str(x ) 将对象 x 转换为字 阅读全文
posted @ 2017-03-15 16:17 懒惰的咕噜 阅读(1024) 评论(0) 推荐(0)