2👍
✅
read()
works the way that it uses a pointer of position which you are reading from the file. So as you read the file, the pointer moves toward its end, until it’s on the very end. So calling read()
again will return nothing, because you’re pointing on the end of the file now.
To read the file again, use seek(0)
first, which will move the pointer to the start of the file again.
Source:stackexchange.com