我有一个包含x个值的列表,称为";状态";我用它来初始化字典。
states_trans_prob = {states.index(s): {0: [], 1:[], 3:[], 4:[], 5:[], 6:[], 7:[], 8:[], 9:[]} for s in states}
如图所示,内部字典有9个关键字。我有另一本字典,叫做";动作";具有相同数量的键,因此我如何初始化字典,而不是如上所示指定它?
states_trans_prob = {states.index(s): {key: [] for key in actions.keys()} for s in states}