#!/usr/bin/env python # import required modules # import os import sys # main: this is the main function of this Python # def main(argv): # let's add some command line argument processing # # first method # with open(sys.argv[1]) as f: for line in f: if (line[0] != '#'): print("1st method: ", line) f.close() # second method # for line in open(sys.argv[1],'r').readlines(): print("2nd method: ", line) # third method # lines = [line.rstrip('\n') for line in open(sys.argv[1])] print("3rd method: ", lines) # begin gracefully # if __name__ == "__main__": main(sys.argv) # # end of file