File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 50
50
>> >
51
51
```
52
52
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.
56
56
57
57
``` py
58
58
>> > with open (' test.txt' , ' w' ) as f:
@@ -98,7 +98,8 @@ before, and it actually remembers its position also:
98
98
Iterators can only be used once, so we need to create a new iterator if
99
99
we want to do another for loop.
100
100
101
- Here's a picture that might explain this better:
101
+ All iterators are iterables, but not all iterables are iterators. Like
102
+ this:
102
103
103
104
![ Iterables and iterators.] ( ../images/iters.png )
104
105
You can’t perform that action at this time.
0 commit comments