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.

def head(f_in, f_out, count=20):
    all([not f_out.write(l2) for l2 in [line for line in f_in][:count]])

head(open('/etc/passwd'), open('/tmp/p', 'w'), count=2)