#!/usr/bin/python

# --*-- coding: utf-8 --*--

directory={
"张三":16,
"李四":46,
"王二":56,
"赵武":32,
"小白":12
}

#定义一个空的字典

dire={}

print(type(dire))

#输出整个字典

print(directory)

#修改字典value,若key不存在会报错
directory["张三"]="17"

#获取字典中key为haha的value,若不存在,返回NONE
print(directory.get('haha'))

#打印字典中所有的key
for i in directory:
print(i,"---->",character[i])

#删除字典中key为‘’小白‘’的那一段key-value

directory.pop('小白')

#打印字段长度
print(len(directory))

print(type(directory))
print(directory)

python-directory的更多相关文章

  1. python idle 错误 subprocess didn't make connection

    今天打开python idle不反应.然后通过网上搜索让我在安装文件夹下点击idle.py 弹出如图所看到的的错误,进行了非常多尝试.任然没有得到解决.可是在尝试过程中发现了大家所说问题所在都是由于新 ...

  2. usb之python(pyusb)

    电脑系统为WIN7 64位 python:为python3.6 32位 需要插件PyUSB-1.0.0.tar,pywinusb-0.4.2. 按照的步骤我偷懒了,自己百度一下. 我们先看设备管理的 ...

  3. 【逆向工具】IDA Python安装与使用

    1.IDA Pyhon介绍 IDA Python是IDA6.8后自带插件,可以使用Python做很多的辅助操作,非常方便的感觉. 2.IDA Python安装 从github上IDAPython项目获 ...

  4. python 常用模块之os

    1.权限判断 bool: os.access('/python/test.py',os.F_OK) #是否存在 bool: os.access('/python/test.py',os.R_OK) # ...

  5. PyQt(Python+Qt)学习随笔:树型部件QTreeWidget的itemAbove、itemBelow方法作用探究

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 在QTreeWidget的方法中,对于itemBelow.itemAbove方法,官网文档介绍非常简 ...

  6. Python报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)”的解决办法

    最近在用Python处理中文字符串时,报出了如下错误: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ...

  7. 自然语言20_The corpora with NLTK

    QQ:231469242 欢迎喜欢nltk朋友交流 https://www.pythonprogramming.net/nltk-corpus-corpora-tutorial/?completed= ...

  8. libsvm-3.21使用文档

    Libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression. (可用于分 ...

  9. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128) 解决办法

    最近在用Python处理中文字符串时,报出了如下错误: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ...

  10. 【转】Installing OpenCV on Debian Linux

    In this post I will describe the process of installing OpenCV(both versions 2.4.2 and 2.4.3) on Debi ...

随机推荐

  1. 关于全局变量,static,define和const

        其实按照现在主流的观点,应该尽量少用全局变量和define,尽量多用临时变量,并且用const替换值define,用短小精悍的函数替换函数define.     对这些我倒是也没有什么意见,只 ...

  2. 在IDEA中设置命令行参数

  3. [UNITY 5.4 UGUI] 模态对话框

    1.建立两个画布 a.背景界面 b.置顶界面(添加一个 panel 控件) 2.修改置顶界面中 panel ,添加属性 [Canvas Group] 3.根据界面设计情况修改透明度,色彩,图片

  4. [leetcode]332. Reconstruct Itinerary

    Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], r ...

  5. mockito 异常Reason: java.io.IOException: invalid constant type: 18

    原因: mockito内部使用的javassit的版本不一致导致的,修改为一直版本即可. 异常内容: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jd ...

  6. Chrome添加Axure RP插件

    之前一直用 Firefox 浏览器浏览原型文件,一直用不惯,而且用 Firefox 的唯一目的就是看原型.其他都是用 Chrome 浏览器,来回切换,各种麻烦,然后下定决心解决 Chrome 浏览器无 ...

  7. es curl 访问

    1. curl -u elastic:mypass -X GET "localhost:9200/my_index/_search?pretty" 相关链接:https://www ...

  8. spring boot 常见的第三方集成

    spring boot基于1.x. 一 集成redis 1.1 配置 spring.redis.host = localhost spring.redis.port = 6379 spring.red ...

  9. 每月IT摘录201904

    技术 1.项目,相比数量,规模更重要. 毫无疑问,在实际工作中,积极参与实际工程项目是快速积累经验最好的办法. 相对于项目的数量,项目的规模更加重要.项目的规模是可以比较容易判断的.实际服务用户的数量 ...

  10. mysql学习笔记--数据库预处理

    一.概念 1. 预编译一次,可以多次执行.用来解决一条sql语句频繁执行的问题 2. 语法 a. 预处理语句:preapre 预处理名字 from 'sql语句' b. 执行预处理:execute 预 ...