In Python, the syntax
for line in f:
sys.stdout.write(line)
can be used to print a file. Except it does not work when the file's last line is incomplete, does not end in a newline. What to do then?
> echo -n > foobar.txt
> cat foobar.py
#!/usr/bin/python
import sys
for line in open("foobar.txt"):
sys.stdout.write(line)
> ./foobar.py
>