本文實(shí)例講述了python創(chuàng)建關(guān)聯(lián)數(shù)組(字典)的方法。分享給大家供大家參考。具體分析如下:
關(guān)聯(lián)數(shù)組在python中叫字典,非常有用,下面是定義字典的兩種方法
# Dictionary with quoted or variable keysd1 = {"name":"donuts","type":"chocolate","quantity":10}# Dictionary with fixed keysd2 = dict(name="donuts",type="chocolate",quantity=10)assert d1 == d2希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選