58

【26】Python Iterator笔记-只争朝夕-51CTO博客

 6 years ago
source link: http://blog.51cto.com/000011211684/2071000
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在讲何为迭代器之前,要区分一件事:Iterable可迭代与Iterator迭代器的区别。可以直接作用域for循环的数据数据类型有以下几种:一类是集合数据类型,如:list、dict、str、set、tuple等一类是generator,包括生成器和带yield的generatorfunction这些是可以直接作用于for循环的对象统称为可迭代对象:Iterable可以使用isinstance()用

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK