有这样的代码:
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' % )
有可能这样做吗?
在%
签名后我需要放置什么?