导航

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 37 下一页

2015年12月23日

摘要: import pymongoconnection = pymongo.MongoClient("127.0.0.1")connection.database.authenticate("root","1234")db = connection.database 阅读全文

posted @ 2015-12-23 23:41 网名还没想好 阅读(258) 评论(0) 推荐(0) 编辑

2015年12月22日

摘要: 转自:http://blog.nathon.wang/2015/06/24/tornado-source-insight-01-gen/用Tornado也有一段时间,Tornado的文档还是比较匮乏的,但是幸好其代码短小精悍,很有可读性,遇到问题时总是习惯深入到其源码中。这对于提升自己的Python... 阅读全文

posted @ 2015-12-22 17:33 网名还没想好 阅读(2372) 评论(1) 推荐(0) 编辑

2015年12月21日

摘要: 编辑 /etc/rc.d/rc.local 将要开启的服务添加到该文件即可 阅读全文

posted @ 2015-12-21 13:03 网名还没想好 阅读(140) 评论(0) 推荐(0) 编辑

摘要: Centos 6.5默认安装的是git 1.7.X 版本,使用过程中会有一些奇怪的问题,对于用户名、密码支持不是很友好。将Centos6.5上的git更新到2.0.5,方法如下:1.安装编译git时需要的包# yum install curl-devel expat-devel gettext-de... 阅读全文

posted @ 2015-12-21 00:12 网名还没想好 阅读(208) 评论(0) 推荐(0) 编辑

2015年12月17日

摘要: 目前我知道的有两种方法:1 定义的类继承dict类例如class A(dict): passa = A()a['name'] = 122 给自定义的类添加__setitem__() __getitem__()方法class A: def __init__(self, cfg={}): self.c... 阅读全文

posted @ 2015-12-17 18:02 网名还没想好 阅读(501) 评论(0) 推荐(1) 编辑

摘要: 列表按难度排序,常用的语言特征和技巧放在前面。1.1 分拆>>> a, b, c = 1, 2, 3>>> a, b, c(1, 2, 3)>>> a, b, c = [1, 2, 3]>>> a, b, c(1, 2, 3)>>> a, b, c = (2 * i + 1 for i in ran... 阅读全文

posted @ 2015-12-17 17:40 网名还没想好 阅读(218) 评论(0) 推荐(0) 编辑

摘要: # -*- coding: utf-8 -*-import loggingdef singleton(cls): instance = {} def _singleton(*args, **kw): if cls not in instance: in... 阅读全文

posted @ 2015-12-17 15:49 网名还没想好 阅读(798) 评论(0) 推荐(0) 编辑

摘要: from tornado import genfrom tornado.ioloop import IOLoop@gen.coroutinedef throw(a,b): try: a/b raise gen.Return('hello') except E... 阅读全文

posted @ 2015-12-17 11:09 网名还没想好 阅读(677) 评论(0) 推荐(0) 编辑

2015年12月16日

摘要: pool = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT,max_connections=3,password=REDIS_PASSWORD)redis = redis.StrictRedis(connection_pool=pool) 阅读全文

posted @ 2015-12-16 14:14 网名还没想好 阅读(789) 评论(0) 推荐(0) 编辑

2015年12月15日

摘要: 转自:http://ghostfromheaven.iteye.com/blog/1562618Python代码#-*-encoding=utf-8-*-print'----------------------方法1--------------------------'#方法1,实现__new__方... 阅读全文

posted @ 2015-12-15 17:07 网名还没想好 阅读(189) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 37 下一页