[英]Run python code from stdin with additional script arguments in PowerShell
The use case is the following:用例如下:
What I have tried so far:到目前为止我已经尝试过:
jupyter nbconvert --to python --stdout .\some_nb.ipynb | python
some_nb.ipynb
awaits for arguments via argparse
so normally I would do something like: some_nb.ipynb
通过argparse
等待 arguments 所以通常我会做类似的事情:
python some_nb.py --argument_one=1
When I do that:当我这样做时:
jupyter nbconvert --to python --stdout .\some_nb.ipynb | python --argument_one=1
argument_one
is of course binded to python
and I am not sure how to properly pipeline this. argument_one
当然绑定到python
,我不知道如何正确地流水线化。
Finally got it.终于明白了。 Python has
-
argument after which it reads arguments from stdin Python 有
-
参数,之后它从标准输入读取 arguments
https://docs.python.org/3/using/cmdline.html https://docs.python.org/3/using/cmdline.html
jupyter nbconvert --to python --stdout .\some_nb.ipynb| python - --argument_one=1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.