Why there are two txt=fo.read (2)

Is it necessary for txt = fo.read (2) before

while to appear?

Why not connect to while, directly after fo = open (fname, "r")

how to understand the logic in this?

...
txt = fo.read(2)
while txt != "":
    txt = fo read(2)
...

Nov.12,2021

python does not have do while
and this kind of problem can be found out by running it yourself.

Menu