欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          python items()方法如何使用

          python items()方法如何使用

          python items()方法如何使用?

          Python 字典(Dictionary) items()方法

          Python 字典(Dictionary) items() 函數(shù)以列表返回可遍歷的(鍵, 值) 元組數(shù)組。

          推薦:《Python教程》

          語法

          items()方法語法:

          dict.items()

          參數(shù)

          NA。

          返回值

          返回可遍歷的(鍵, 值) 元組數(shù)組。

          以下實例展示了 items()函數(shù)的使用方法:

          實例(Python 2.0+)

          #!/usr/bin/python # coding=utf-8   dict = {'Google': 'www.google.com', 'Runoob': 'www.php.cn', 'taobao': 'www.taobao.com'}   print "字典值 : %s" %  dict.items()   # 遍歷字典列表 for key,values in  dict.items():     print key,values

          以上實例輸出結(jié)果為:

          字典值 : [('Google', 'www.google.com'), ('taobao', 'www.taobao.com'), ('Runoob', 'www.php.cn')] Google www.google.com taobao www.taobao.com   php www.php.cn

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號