Jupyter运行argparse报错:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("x", type=int, help="the base")
parser.add_argument("y", type=int, help="the exponent")
args = parser.parse_args()
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
搜索错误,得到一条相关文章
该文章并没解决问题,于是实验,依然报错
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("echo",help="echo the string you use here")
args = parser.parse_args()
print(args.echo)
最后突然想到,应该从命令行执行.py文件,得到解决