File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050>> >
5151```
5252
53- We can also iterate over [ files] ( ../basics/files.md ) , but they change
54- when we do that. They remember their position, so if we iterate over
55- them twice we get the content once only .
53+ We can also iterate over [ files] ( ../basics/files.md ) , but they remember
54+ their position and we get the content once only if we iterate over them
55+ twice.
5656
5757``` py
5858>> > with open (' test.txt' , ' w' ) as f:
@@ -98,7 +98,8 @@ before, and it actually remembers its position also:
9898Iterators can only be used once, so we need to create a new iterator if
9999we want to do another for loop.
100100
101- Here's a picture that might explain this better:
101+ All iterators are iterables, but not all iterables are iterators. Like
102+ this:
102103
103104![ Iterables and iterators.] ( ../images/iters.png )
104105
You can’t perform that action at this time.
0 commit comments