“bootMode”:{“manageMode”:是的,“模式”:“UEFIOptimized”}
我想更改“mode”的值:“UEFIOptimized to”mode“:”UEFI“。
答案 0 :(得分:3)
我假设你的代码是:
some_dict = { ..., "bootMode": {"manageMode": True, "mode": "UEFIOptimized"}, ... }
问题是您必须更改嵌套的dict值。这比你想象的容易。
sub_d = some_dict["bootMode"] # the dictionary you want to change
sub_d["mode"] # the value you want to change
sub_d["mode"] = "UEFI" # ...and how to change it.
总之,你有
some_dict["bootMode"]["mode"] = "UEFI"
答案 1 :(得分:1)
收藏集的Set To Dictionary关键字在此处很有用。
Set To Dictionary ${bootMode} mode UEFI