摘要: import timedef tail(filepath): with open(filepath,'rb') as f: f.seek(0,2) while True: line=f.readline() if line: yield line else: time.sleep(0.05)def 阅读全文
posted @ 2018-01-02 21:22 xiongrongqin123 阅读(578) 评论(0) 推荐(0) 编辑
摘要: def my_range(start,stop,step=1): while start < stop: yield start #start=1 start+=step #start=3 g=my_range(1,7,2) print(g) for i in my_range(1,7,2): pr 阅读全文
posted @ 2018-01-02 21:17 xiongrongqin123 阅读(366) 评论(0) 推荐(0) 编辑
摘要: dic={'a':1,'b':2,'c':3}iter_dic=dic.__iter__()print(iter_dic.__next__()) #等同于next(iter_dic) 阅读全文
posted @ 2018-01-02 21:04 xiongrongqin123 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1,类似格式话输出的占位符s%. #print('my name is {} ,I like {} ',format('xiong','reading')) 2, #print(‘{0} {1} {0}’,format(‘a’,‘b’)) 3, #print(‘{name} {age}’,forma 阅读全文
posted @ 2017-12-12 21:49 xiongrongqin123 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 重点掌握: 1,按照索引取值,正向+反向取值 2,切片(顾头不顾尾,可设定步长) 3,长度len #mag=‘xiong’ #print(len(mag)) 4,成员运算in或者not in 5,移除空白strip #strip(*) #即移除相应符号 6,切分(slipt) #注意slipt与rs 阅读全文
posted @ 2017-12-12 21:38 xiongrongqin123 阅读(199) 评论(0) 推荐(0) 编辑