Currently I am using argparse for parsing arguments in this fashion :
outputFile = ""
input
def getArguments():
parser = argparse.ArgumentParser(description='Execute the given pig script and pipe the output to given outFile.')
parser.add_argument('-o','--outputFile', help='Output file where pig file execution output is stored.', required=True)
input = parser.parse_args()
print ("========================================")
print ("Argument to the script")
print ("outputFile = %s" % input.outputFile )
return input
input = getArguments()
outputFile = input.outputFile
print ("outputFile = %s" % outputFile )
My question is, is there a way a better AND/OR more compact way of writing parsing in this way ?
Note : I am especially trying to look for binding of parsed argument to the variable in the file. I hope to not to use "input" variable every-time I access input-argument nor do I want to have explicit variable declared just to copy the parameters from the argument-string to a variable.