我正在寻找最好的pythonic方法来做到这一点。
嵌套字典看起来像这样(主脚本):
my_dict = { test: { 
                   test_a: 'true',
                   test_b: 'true
                  }
我正在导入一个具有返回数值的函数的模块。
我正在寻找一种从模块返回的字典中附加到 my_dict 字典的方法。
即来自模块的功能:
def testResults1():
  results = 3129282
  return results
def testResults2():
  results = 33920230
  return results
def combineResults():
  Would like to combine results, and return a dictionary. Dictionary returned is:
  # Looking for best way to do this.
  test_results = { 'testresults1': 3129282, 
                   'testresults2': 33920230
                  }
然后我想将 test_results 字典附加到 my_dict。也在寻找最好的方法来做到这一点。
先感谢您!