Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Anaconda 如何在IPython jupyter笔记本中传递命令行参数_Anaconda_Jupyter Notebook_Ipython_Argparse - Fatal编程技术网

Anaconda 如何在IPython jupyter笔记本中传递命令行参数

Anaconda 如何在IPython jupyter笔记本中传递命令行参数,anaconda,jupyter-notebook,ipython,argparse,Anaconda,Jupyter Notebook,Ipython,Argparse,我是伊皮顿的新朋友。目前,我已经使用Anaconda安装了Ipython,并使用jupyter笔记本用户界面编写了绘制图表的代码。 我想在argparse模块的帮助下将一些参数传递给我的工作脚本。 下面是代码 import argparse parser = argparse.ArgumentParser(description = 'Process display arguments') parser.add_argument('-t', "--test_name", help="Manda

我是伊皮顿的新朋友。目前,我已经使用Anaconda安装了Ipython,并使用jupyter笔记本用户界面编写了绘制图表的代码。 我想在argparse模块的帮助下将一些参数传递给我的工作脚本。 下面是代码

import argparse

parser = argparse.ArgumentParser(description = 'Process display arguments')
parser.add_argument('-t', "--test_name", help="Mandatory test name directory path", type=str)
parser.add_argument('-s', "--symbolSet", nargs = '?', help="Optional symbolset", const = 'baz', default = 'deafultOne')
args = parser.parse_args()
if args.test_name is None:
        print("test_name argument is mandatory.. Use option -h for help.. Exiting..")
        sys.exit(1)
现在,如何在通过UI执行脚本时传递这些参数,或者如何通过命令提示符运行脚本并仍然能够绘制图表?
我在windows机器上工作。如果你需要更多信息,请告诉我。在此基础上。

print(args)
语句中添加,以便您可以查看
parse_args()
生成的内容。它还可以方便地添加
importsys
print(sys.argv)
以查看解析器需要处理什么。也就是说,这是否可以作为普通的
python
脚本使用?或者使用普通的
ipython
?启动
jupyter
时,您向服务器发出命令,而不是笔记本本身。我想之前已经讨论过了,但现在还不能匹配。所以我没有其他选择?是否不可能使用Ipython笔记本UI绘制图表&同时将参数传递给脚本?