摘要: class F(object): _b = ['d','a','b','c'] def __init__(self, **kwargs): for i in kwargs.iteritems(): if i[0] in self._b: self.__dict__[i[0]] = i[1] else: raise AttributeError("error")f = F(c=33, a=1,b=2, d=445)print f.aprint f.bprint f.d... 阅读全文
posted @ 2013-01-04 16:16 践道者 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 #coding=utf8 2 3 import threading 4 import time 5 import logging 6 7 logging.basicConfig( 8 level=logging.DEBUG, 9 format='[%(levelname)s]-(%(threadName)s)-%(message)s',10 )11 12 def worker():13 logging.debug('starting')14 #print 'I am worker:'15 time.sleep(2)16 logging.... 阅读全文
posted @ 2013-01-04 14:29 践道者 阅读(1142) 评论(0) 推荐(0) 编辑