Ex20.py #rewind function. still confused by the rewind function

Here is the thing. What does “rewind” function do? I’m confused.
First there is current_file = open(input_file)
Then print_all(current_file)

The current file now is the input_file. Then why I delete all the “rewind” function, python cannot tell what the current file contains.


I mention this in a few other posts, but you have to think about files as if they’re tapes. You read a file (play the tape), write to a file (record to the tape), and the read/write head moves to that spot. If you want to back up and listen to what you just recorded, you have to seek to it or rewind it.