zoukankan      html  css  js  c++  java
  • Python中的字典

    info = {
        'name':'Xiao',
        'age':'22',
        'high':'176',
    }

    字典是无序的,没有下标,通过key来取值

    查找:print(info["name"]))    或者  print(info.get('name'))

    修改: info["name"] = "Li"

    创建: info["name2"] = "Liu"

    删除: del info["high"] 或者 info.pop("name") 

    多级字典嵌套及操作:

    info.values()  打印所有的值

  • 相关阅读:
    Ubuntu
    SSH
    Markdown
    Mac OS 上的一些骚操作
    Linux Bash
    JConsole
    IDEA
    Groovy
    Github
    Git
  • 原文地址:https://www.cnblogs.com/new-journey/p/10516402.html
Copyright © 2011-2022 走看看