head in python
Was going to post this to stackoverflow, but the question was deleted before I posted.
Turned out it was a fun exercise in writing a short program.
1def head(f_in, f_out, count=20):
2 all([not f_out.write(l2) for l2 in [line for line in f_in][:count]])
3
4head(open('/etc/passwd'), open('/tmp/p', 'w'), count=2)