“cara menyimpan variabel di kamus” Kode Jawaban

cara menyimpan variabel di kamus

>>> 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
Helpful Hawk

cara menyimpan variabel di kamus

>>> mydict = {"message": {"hello": 123456}}
>>> print(mydict['message'])
{'hello': 123456}
>>> print(mydict['message']['hello'])
123456
Helpful Hawk

Jawaban yang mirip dengan “cara menyimpan variabel di kamus”

Pertanyaan yang mirip dengan “cara menyimpan variabel di kamus”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya