3 ms·
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:
by eesmith 7y ago
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)
- rspivak 7y agoThat's a good point. Thanks!