将jupyter笔记本作为带有变量重写的命令行脚本运行
jrun的Python项目详细描述
以命令行脚本的形式运行jupyter笔记本,并使用变量覆盖
要使变量可重写,请使用jin包装它们,如下所示
fromjrunimportjin# First parameter is identifier, second is default valueseed=jin("seed",1234)speed=jin("speed",45)trial_number=jin("tno",1)# Other code
直接运行笔记本(jrun notebook.ipynb)将使用默认值 参数值。要重写其中任何一个,请将另一个参数传递给jrun 在纯python中指定重写,如jrun notebook.ipynb "tno = 2; seed = 2313"。