6 ms·
Feel free to add your own implementation. :)
Feel free to add your own implementation. :)
FWIW, iter() handles the logic of testing for an explicit EOF marker, so another way to write it is:
import sys
with open(sys.argv[1]) as fin:
for c in iter((lambda: fin.read(1)), ""):
sys.stdout.write(c)