python-directory
#!/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的更多相关文章
- python idle 错误 subprocess didn't make connection
今天打开python idle不反应.然后通过网上搜索让我在安装文件夹下点击idle.py 弹出如图所看到的的错误,进行了非常多尝试.任然没有得到解决.可是在尝试过程中发现了大家所说问题所在都是由于新 ...
- usb之python(pyusb)
电脑系统为WIN7 64位 python:为python3.6 32位 需要插件PyUSB-1.0.0.tar,pywinusb-0.4.2. 按照的步骤我偷懒了,自己百度一下. 我们先看设备管理的 ...
- 【逆向工具】IDA Python安装与使用
1.IDA Pyhon介绍 IDA Python是IDA6.8后自带插件,可以使用Python做很多的辅助操作,非常方便的感觉. 2.IDA Python安装 从github上IDAPython项目获 ...
- python 常用模块之os
1.权限判断 bool: os.access('/python/test.py',os.F_OK) #是否存在 bool: os.access('/python/test.py',os.R_OK) # ...
- PyQt(Python+Qt)学习随笔:树型部件QTreeWidget的itemAbove、itemBelow方法作用探究
老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 在QTreeWidget的方法中,对于itemBelow.itemAbove方法,官网文档介绍非常简 ...
- 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: ...
- 自然语言20_The corpora with NLTK
QQ:231469242 欢迎喜欢nltk朋友交流 https://www.pythonprogramming.net/nltk-corpus-corpora-tutorial/?completed= ...
- libsvm-3.21使用文档
Libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression. (可用于分 ...
- 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: ...
- 【转】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 ...
随机推荐
- java高并发实战(二)——线程(并行程序)基础
转自:https://blog.csdn.net/gududedabai/article/details/80815666
- Jdbc使用SSH连接mysql
pom.xml <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-ja ...
- SQL Server 2016 在Windows Server 2012 R2 上的初步安装与远程连接实战(一):初步配置
1.安装过程没有什么说头 2.下载并安装SSMS(SQLServer Management Studio),目前已更新到2017.1 3.使用SSMS登陆数据库 第一次选择Windows 身份验证,可 ...
- Android导出数据库文件
由于Android系统权限问题,直接用Android Studio 的Device File Explorer无法查看墨人生成的*.db文件,不过可以通过adb命令获取到: adb pull /dat ...
- Python连接Access数据库遇到问题'ADODB.Connection', '未找到提供程序。该程序可能未正确安装。'的处理办法
环境Windows7+python3.6.4 x64位+AccessDatabaseEngine_X64.exe,执行代码: import win32com.client conn = win32co ...
- Centos6.3下搭建apache+https服务
1. 安装插件 yum install mod_ssl openssl openssl-devel --downloadonly --downloaddir=/home/https 2.生成私钥 op ...
- C# 小算法1
//判断 第一条的 ‘叶子2’ 在 第二条 数据中的 索引 //任河特大桥,右幅,叶子2,桩基混凝土, //任河特大桥,,,,,右幅,,,叶子2,桥墩, string str1 = "任河特 ...
- eclipse与idea快捷键对比以及idea debug、git快捷键
eclipse与idea快捷键 表格中的空格都是忘记了~ 功能 eclipse idea 生成返回值对象 alt+shift+L ctrl+alt+V 找到启动类 ctrl+alt+Home 类的 ...
- 3G设置linux路由-iptables配置
1.如何区分iptables的PREROUTING和POSTROUTING链 (引自http://jingyan.baidu.com/article/aa6a2c143d84470d4c19c4cf. ...
- JAVA字符串的处理
问题描述: 从键盘数入若干文字,最后输入的一行"end"代表结束标记. 统计该段文字中英文字母的个数 将其中的所有单词the全部改为a,输出结果 将该段文字所有的数字串找出来输出 ...