【发布时间】:2021-11-02 14:42:54
【问题描述】:
我有一个带参数的字典,我想将 dic={a:b,c:d,e:f} 传递到像这样“os.system(dic)”这样的“os.system”中,但是得到错误。 当我直接在 os.system 内部传递所有参数时,它工作正常,但从字典传递时出错
【问题讨论】:
-
尝试:
os.system(**your_dict)进行 kwarg 解包。也请不要在代码中重复使用内置函数的名称。所以叫它dict以外的东西。
标签: python-3.x dictionary os.system