Skip to content

Instantly share code, notes, and snippets.

@migonzalvar
Created June 25, 2014 08:46
Show Gist options
  • Save migonzalvar/e8c331a46919ac5f1daf to your computer and use it in GitHub Desktop.
Save migonzalvar/e8c331a46919ac5f1daf to your computer and use it in GitHub Desktop.
#! /usr/bin/env python3
""" cat.py - Print a file. """
import sys
# Parse arguments
file_name = sys.argv[1]
with open(file_name, 'rt') as f:
for n, line in enumerate(f):
sys.stdout.write(line)
sys.stderr.write('%d lines\n' % n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment