Passing command line arguments to argv in jupyter/ipython notebook

前端 未结 8 1322
-上瘾入骨i
-上瘾入骨i 2020-11-28 09:34

I\'m wondering if it\'s possible to populate sys.argv (or some other structure) with command line arguments in a jupyter/ipython notebook, similar to how it\'s

8条回答
  •  余生分开走
    2020-11-28 10:21

    There are two projects I've found that do what you ask for

    • Papermill, will add a cell to your notebook with arguments that you pass to it on the command line. So this is quite straightforward, you define your defaults in the first cell (the should have parameters tag)
    • nbparameterise it is a similar concept but you don't tag your cell with defaults, it has to be first.

    Here is a good resource discussing the issue: https://github.com/jupyter/help/issues/218

提交回复
热议问题