【发布时间】:2015-04-22 01:57:25
【问题描述】:
有这样的代码:
if __name__ == "__main__":
parser.add_argument("--u_shape_dict", default="", action='store',
help="required for ...")
parser.add_argument("--v_shape_dict", default="", action='store',
help="required for ...")
u_shape_dict = args['u_shape_dict']
if not u_shape_dict:
raise Exception('u_shape_dict is missing. Please provide it')
v_shape_dict = args['v_shape_dict']
if not v_shape_dict:
raise Exception('v_shape_dict is missing. Please provide it')
我想将这两个异常合并为一个,如下所示:
if not u_shape_dict or v_shape_dict:
raise Exception('%s is missing. Please provide it' % )
有可能吗?
实际上我需要在% 符号之后添加什么?
【问题讨论】:
标签: python python-2.7 python-2.x command-line-arguments