【发布时间】:2018-12-20 22:44:06
【问题描述】:
如何从 python 脚本(Ubuntu shell)调用函数,同时传递配置参数?相关的 SO post 似乎没有解决这个问题。
这是我现在拥有的:
$ python -c ' from python_library import * ; function() ; -config /path/to/config/file '
上述失败。以下(以及许多其他)组合也是如此:
$ python -c ' from python_library import * ; function() -config /path/to/config/file '
或
$ python -c ' from python_library import * ; function() ; -config "/path/to/config/file" '
谢谢!
【问题讨论】:
-
` -config "/path/to/config/file"` 不是python代码,为什么要在引用的命令中包含它
-
我正在尝试将参数(配置文件)传递给我的脚本,而原始帖子中包含的示例是失败的尝试。