这是我的原版词典:
original_dict = {
"Teachers": {
"Maths": "Kiran",
"Physics": "David",
"Chemistry": "Ravi"
}
}
我想从列表中更改数学、物理和化学的值:
my_new_values_list = ["Alex", "Rahul", "Micheal"]
我希望我的词典在从列表中更改词典的值后看起来是这样的:
{
"Teachers": {
"Maths": "Alex",
"Physics": "Rahul",
"Chemistry": "Micheal"
}
}
有没有人能帮我从一个列表中自动更新字典值?
1条答案
按热度按时间mrfwxfqh1#
试着这样做:
产出: