From: Matt Davis Date: Sat, 11 May 2013 05:23:16 +0000 (-0700) Subject: Adding mean animals command line script. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d64750bf563ad3c0e29677d293a7c7432093c7e;p=swc-testing-nose.git Adding mean animals command line script. --- diff --git a/python/sw_engineering/mean_sighted.py b/python/sw_engineering/mean_sighted.py new file mode 100755 index 0000000..51aea49 --- /dev/null +++ b/python/sw_engineering/mean_sighted.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# The line above tells the shell to run this script with Python. +import sys + +from meananimals import mean_animals + +# sys.argv contains the arguments the user entered at the command line when +# calling this script. See more at http://docs.python.org/2/library/sys.html. +# Another great way of putting together command line interfaces for scripts +# is the argparse module: http://docs.python.org/2/library/argparse.html + +# Try running this script by typing "./mean_sighted.py big_animals.txt Elk" +# at the command line. + +if len(sys.argv) != 3: + print 'Usage: mean_sighted.py ' +else: + filename = sys.argv[1] + species = sys.argv[2] + print mean_animals(filename, species)