1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| import argparse
def main(): parser = argparse.ArgumentParser(description='') parser.add_argument('--input-file', '-i', help='输入文件路径') parser.add_argument('--output-file', '-o', help='输出文件路径')
_debug = True args = vars(parser.parse_args( '-i {input_file} -o {output_file}'.format(**{ 'input_file': 'input.xls', 'output_file': 'output.xml' }).split(' '))) if _debug else vars(parser.parse_args())
print(args)
if __name__ == "__main__": main()
|