I am trying to set up some simple flag arguments for my program but cannot figure out how to access them. I have the argparser:
parser = argparse.ArgumentParser(description='Simple PostScript Interpreter') parser.add_argument('-s', action="store_true") parser.add_argument('-d', action="store_true") parser.parse_args(sys.argv[1:]) The program should take either sps.py -s, sps.py -d, or sps.py on the command line. Then I just want to check whether or not the -s flag was set or the -d flag was set. If neither were set, then just default to -d.
What do I need to do to access the boolean values that are set by the parser?