摘要: xxx 三元表达式 name="alex" res="SB" if name == "alex" else "shuai" print(res) SB 列表生成式 语法 [expression for item1 in iterable1 if condition1 for item2 in ite 阅读全文
posted @ 2017-08-06 16:43 golangav 阅读(698) 评论(0) 推荐(0) 编辑
摘要: 生成器 from collections import Iterator def test(): print("one") yield 1 print("two") yield 2 print("three") yield 3 obj = test() res = next(obj) print(r 阅读全文
posted @ 2017-08-06 11:46 golangav 阅读(319) 评论(0) 推荐(0) 编辑