Skip to content

Instantly share code, notes, and snippets.

@migonzalvar
Created June 25, 2014 09:01
Show Gist options
  • Save migonzalvar/248c788574b2973e4073 to your computer and use it in GitHub Desktop.
Save migonzalvar/248c788574b2973e4073 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python3
""" tee.py - Tee a file. """
import sys
# Parse arguments
file_name = sys.argv[1]
with open(file_name, 'wt') as file_out:
for n, line in enumerate(sys.stdin):
file_out.write(line)
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