# File object is an iterator
1 from collections import Iterator,Iterable 2 fp = open("ceshi1",mode="r",encoding="utf-8") 3 print(isinstance(fp,Iterator)) # True
Introducing the Iterator (iterators) collections from the class file, fp is determined by whether isinstance Iterater.