From 7d64750bf563ad3c0e29677d293a7c7432093c7e Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Fri, 10 May 2013 22:23:16 -0700 Subject: [PATCH] Adding mean animals command line script. --- python/sw_engineering/mean_sighted.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 python/sw_engineering/mean_sighted.py 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) -- 2.26.2