尝试索引python dict时出现语法错误:(Pdb) o_model.flows{(<oemof.solph.network.Bus object at 0x7f3e9c6b3ea8>, <oemof.solph.network.Transformer object at 0x7f3e9c52ce08>): <oemof.solph.network.Flow object at 0x7f3e9c50d5f8>}这是字典的关键。:(Pdb) o_model.flows.keys()dict_keys([(<oemof.solph.network.Bus object at 0x7f3e9c6b3ea8>, <oemof.solph.network.Transformer object at 0x7f3e9c52ce08>)])所以我假设字典的关键是(<oemof.solph.network.Bus object at 0x7f3e9c6b3ea8>, <oemof.solph.network.Transformer object at 0x7f3e9c52ce08>)问题是我在尝试o_model.flows使用上面提到的键索引 时遇到语法错误。通常我希望通过获取<oemof.solph.network.Flow object at 0x7f3e9c50d5f8>dict的 value( ),但我得到了一个语法错误:(Pdb) o_model.flows[(<oemof.solph.network.Bus object at 0x7f3e9c6b3ea8>, <oemof.solph.network.Transformer object at 0x7f3e9c52ce08>)]*** SyntaxError: invalid syntax我做错了什么?一些额外的:(Pdb) type(o_model.flows)<class 'dict'>
添加回答
举报
0/150
提交
取消