i trying process file passed command line argument. right there 1 argument, plan add others.
here code 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 pass argument file handle open , process. , yes, n00b. try block there testing.
you need pass filename string. then, can use open() open file filename. refer python docs here (7.2 - reading & writing files).
Comments
Post a Comment