python3 读取命令行的参数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shaoyou223/article/details/84762366

import argparse

parser = argparse.ArgumentParser(description='Example with non-optional arguments')

parser.add_argument('count', action="store", type=int)
parser.add_argument('units', action="store")
results = parser.parse_args()
print(results.count)
print(results.units)

猜你喜欢

转载自blog.csdn.net/shaoyou223/article/details/84762366