摘要: 26、字符串格式化 1、以下摘自老师的blog。 字符串格式化 Python的字符串格式化有两种方式: 百分号方式、format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存。[PEP-3101] This PEP proposes a ne 阅读全文
posted @ 2016-08-11 15:32 哈嘉好啊 阅读(1896) 评论(0) 推荐(0) 编辑
摘要: 27、生成器: 1、 >>> def f1(): ... print(123) ... yield 1 ... yield 2 ... yield 3 ... >>> ret = f1() >>> ret.__next__() # 进入函数找到yield 获取yield 后面的数据。 123 1 > 阅读全文
posted @ 2016-08-11 15:31 哈嘉好啊 阅读(139) 评论(0) 推荐(0) 编辑