Bus errorとSegmentation faultに困ったら見るブログ

物理の研究者による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【python3.5↑】辞書型の連結

■ 参考 : [python] 辞書の結合


python3.5以降なら

d1 = {'one':1, 'two':2}
d2 = {'two':'ii', 'three':'iii'}
d3 = {'three':'III', 'four':'IV'}
d4 = {**d1, **d2, **d3}

python3.9以降なら

という演算子で、2つの辞書型を連結できるらしい

ランキング参加中です

↓クリックしていただけると嬉しいです〜