I\'m trying to set up a dictionary as optional argument (using argparse); the following line is what I have so far:
parser.add_argument(\'-i\',\'--image\', t
Using simple lambda parsing is quite flexible:
parser.add_argument( '--fieldMap', type=lambda v: {k:int(v) for k,v in (x.split(':') for x in v.split(','))}, help='comma-separated field:position pairs, e.g. Date:0,Amount:2,Payee:5,Memo:9' )