If I have a file iterator
with open('test1.txt','r') as f1:
print(f1.__next__())
But if I do the same thing for a list, it doesn't work.
a1 = [1,2,3,4,5]
a1.__next__()
So, what is difference between file iterator and list iterator? Do file and list (or tuple, dictionary, etc.) iterators behave differently?
__next__method directly, please use thenextfunction, egnext(f1). The same goes for most other "magic" methods whose names begin & end with double underscores (aka dunder methods). So use thelenfunction, not the__len__method, thestrfunction, not the__str__method, etc.