How to determine whether the file handle iterator?

# 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.

Guess you like

Origin www.cnblogs.com/youhongliang/p/11844871.html