I am trying to process a file passed as a command line argument. Right now there is only one argument, but I plan to add others.
Here is my code so far:
import argparse
parser = argparse.ArgumentParser(description="Sample arg parsing")
parser.add_argument('-f',type=file)
try:
print parser.parse_args()
except IOError, msg:
parser.error(str(msg))
I can't figure out how to pass the argument to file handle to open and process. And yes, I am a n00b. The try block is just there for testing.