美文网首页
函数1:字典.items()

函数1:字典.items()

作者: Iphone60Plus | 来源:发表于2020-03-31 18:48 被阅读0次
    #dict_items:元组
    #字典.item():字典元组化
    aaa = {'Google': 'www.google.com', 'Runoob': 'www.runoob.com', 'taobao': 'www.taobao.com'}
    print('字典元组化{}'.format(aaa.items()))
    # 结果:字典元组化dict_items([('Google', 'www.google.com'), ('Runoob', 'www.runoob.com'), ('taobao', 'www.taobao.com')])
    a = aaa.items()
    print(type(a))
    # 结果:<class 'dict_items'>
    for i in a:
        print(i[0])
    # 结果:Google Runoob taobao
    

    相关文章

      网友评论

          本文标题:函数1:字典.items()

          本文链接:https://www.haomeiwen.com/subject/oqsguhtx.html