我不太清楚这里的术语,所以请容忍我。
假设我有一个这样的构造函数调用:

machineSpecificEnvironment = Environment(
   TI_C28_ROOT = 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000',
   JSDB = 'c:/bin/jsdb/jsdb.exe',
   PYTHON_PATH = 'c:/appl/python/2.6.4',
)

除了我想通过提供给我的字典的操作来替换它:
keys = {'TI_C28_ROOT': 'C:/appl/ti/ccs/4.1.1/ccsv4/tools/compiler/c2000',
        'JSDB': 'c:/bin/jsdb/jsdb.exe',
        'PYTHON_PATH': 'c:/appl/python/2.6.4'}
machineSpecificEnvironment = Environment(
     ... what do I put here? it needs to be a function of "keys" ...
)

我该怎么做?

最佳答案

machineSpecificEnvironment = Environment(**keys)

10-01 23:06