摘要: 生成器 生成器表达式形式: 生成器函数形式: 迭代器 可迭代对象:可以直接for循环 1.集合数据类型:列表,字典,字符串等 2.生成器和带yield的generator方法 判断对象是否可迭代:isinstance 迭代器:可以被next()函数调用并不断返回下一个值的对象。 iter(a) it 阅读全文
posted @ 2018-06-05 16:53 辉辉辉辉a 阅读(151) 评论(0) 推荐(0) 编辑
摘要: def func(n): count = 0 while count def func(n): count = 0 while count count 0 def func(n): count = 0 while count < n: print('count',count) count += 1... 阅读全文
posted @ 2018-06-05 14:52 辉辉辉辉a 阅读(96) 评论(0) 推荐(0) 编辑