概要
Pythonで「辞書を作成する」の動作を確認してみました。以下のページを参考にしました。
実装
以下のファイルを作成しました。
sample.py
x = 1
y = "Desktop"
mydict = {x:y}
print(mydict)
mydict = {1:"Desktop"}
print(mydict)
x = 1
y = "Desktop"
mydict = {x:y}
print(mydict)
y = "Movile"
print(mydict)
以下のコマンドを実行しました。
$ python3 sample.py
{1: 'Desktop'}
{1: 'Desktop'}
{1: 'Desktop'}
{1: 'Desktop'}
まとめ
何かの役に立てばと。