📜  如何将变量存储在字典中 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:08.731000             🧑  作者: Mango

代码示例2
>>> mydict = {'a': 'hello', 'b': 'world'}
>>> for x in mydict:
...    val = mydict[x]
...    mydict[x] = val.upper()
...    print('Changed what', x, 'points to: from', val, 'to', mydict[x])
Changed what b points to: from world to WORLD
Changed what a points to: from hello to HELLO