start new:
tmux
start new with session name:
tmux new -s myname
| parser=argparse.ArgumentParser() | |
| parser.add_argument('-k','--kwarg',nargs=3,action='append') | |
| args=parser.parse_args('-k mass 100 inf -k spin 0.5 1.0'.split()) | |
| Namespace(kwarg=[['mass', '100', 'inf'], ['spin', '0.5', '1.0']]) | |
| they could be converted to a dictionary with an expression like: | |
| vargs={key:(float(v0),float(v1)) for key,v0,v1 in args.kwarg} | |
| which could be passed to your function as: |
| def parse_cmd_args(): | |
| parser = argparse.ArgumentParser(description='run the procedure of advice opinion extraction') | |
| parser.add_argument('config', help='config file path') | |
| parser.add_argument('-b', '--begin', type=int, default=-1, help='The process step to begin') | |
| parser.add_argument('-e', '--end', type=int, default=-1, help='The process step to end') | |
| parser.add_argument('-t', '--test', action='store_true', help='Indicate test or not') | |
| args = parser.parse_args() | |
| return args |