#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os.path
import argparse

def head_output(num, filename):
    with open(filename, 'r') as fr:
        for i in range(num):
            f = fr.readline()
            sys.stdout.write(f)

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--num', type=int, required=True, 
      help='you want to output line number from head of file')
    parser.add_argument('--filename', type=str, default='col1.txt',
      help='you want to output file name')
    args = parser.parse_args()

    if not os.path.exists(args.filename):
        print args.filename + " is not found."
        exit(1)
    else:
        head_output(args.num, args.filename)
