#!/usr/bin/env python """This first string tells what the program does, often who wrote it, when, and when it was modified. This is what will be printed out if the __doc__ string is read for this program. There is also a usage note as is shown below Usage: python SampleProg.py """ # standard modules import sys #imports things just as you would from the interpreter import os def do_comparison(x,y): # this is a module """Here we document what the module does. This is what will be printed if we dir(SampleProg.do_comparison) from the interpreter. """ print "Testing if x and y are equal... " if x==y: print "TRUE" return 1 else: print "FALSE" return 0 def read_format(file): """Here we document what the module does This is what will be printed if we dir(SampleProg.read_format) from the interpreter. """ cur_handle = open(file, "r") # opens a file for reading contents=cur_handle.read() print contents cur_handle.close() if __name__ == "__main__": if len(sys.argv) != 2: print __doc__ sys.exit() read_format(sys.argv[1])