How can I accept the opt result
opt, args = parser.parse_args()
and put it in a dict? A Python call selects an "instance of values", and I cannot find a way to turn an instance of values ββinto a list or dict. Therefore, you cannot copy elements from opt,
for i in opt: myDict[i] = opt[i]
instead its clumsy,
myDict[parm1] = opt.parm1 myDict[parm2] = opt.parm2
which implies that every time I add a parameter, I must also update this code; there must be a way to let this take care of itself.
python dictionary optparse
mgag Nov 18 '09 at 3:31 2009-11-18 03:31
source share