#!/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. spring boot 入门(一)

    转自构建微服务:Spring boot 入门篇 什么是spring boot Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程. ...

  2. win10关不了机解决办法以及win10怎么禁止开机启动项

    1.win10关不了机解决办法:https://zhidao.baidu.com/question/693962749213927924.html 2.win10怎么禁止开机启动项:https://j ...

  3. PyCharm 服务器激活地址

    http://www.cnblogs.com/littlehb/p/7784517.html

  4. Python——Django运行问题

    1.Python3.7+Django2.2操作Mysql数据库时出现如下错误:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3. ...

  5. MySQL慢查询日志相关的文件配置和使用。

    MySQL慢查询日志提供了超过指定时间阈值的查询信息,为性能优化提供了主要的参考依据,是一个非常实用的功能,MySQL慢查询日志的开启和配置非常简单,可以指定记录的文件(或者表),超过的时间阈值等就可 ...

  6. H5自定义金额键盘,改良后ios体验效果流畅

    下载的别人的插件改良一下,源码地址:https://github.com/XieTongXue/how-to/tree/master/pay-h5 没有插件,直接来代码 <div class=& ...

  7. 吴裕雄 python 机器学习——ElasticNet回归

    import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...

  8. shardingsphere多数据源(springboot + mybatis+shardingsphere+druid)

    org.springframeword.boot:spring-boot-starer-web: 2.0.4release io.shardingsphere:sharding-jdbc-spring ...

  9. Java框架spring Boot学习笔记(十):传递数据到html页面的例子

    新建一个templates文件夹和index.html <!DOCTYPE html> <html> <head lang="en"> < ...

  10. PHP拦截器之__set()与__get()的理解与使用方法

    “一般来说,总是把类的属性定义为private,这更符合现实的逻辑.   但是,对属性的读取和赋值操作是非常频繁的,因此在PHP5中,预定义了两个函数“__get()”和“__set()”来获取和赋值 ...