# Python3.4 Eclipse+PyDev  打开Eclipse,找到Help菜单栏,进入Install New Software…选项。
# 点击work with:输入框的旁边点击Add…,Name可以随便是什么,我输入的是PyDev,Location是http://pydev.org/updates。点击OK。
import json
import os
import nltk
import collections
import heapq
import operator
import itertools sent=["In","the","beginning","God","created"];
wo=nltk.bigrams(sent);
for w in wo:
print(w); #字典 geovindu 塗聚文
prices={"ACME":45.23,"APPLE":612.79,"IBM":205.55,"HP":37.20,"FB":10.67};
min_prices=min(zip(prices.values(),prices.keys()));
max_prices=max(zip(prices.values(),prices.keys()));
sort_prices=sorted(zip(prices.values(),prices.keys()));
name_prices=min(prices,key=lambda k:prices[k]); max_pricesstr=max(zip(prices.values(),prices.keys())); print("最小值對應值:"+name_prices); for mi in min_prices:
print(mi) #print(min_prices);
#print(max_prices);
#print(sort_prices); print("排序:");
for mis in sort_prices:
print(mis)
print("最高股票:");
for mix in max_prices:
print(mix) #字典中查相同點
dirA={
"geovindu":32,
"塗聚文":28,
"江東":12,
"劉若英":40,
"english":22
} dirB={
"涂聚文":28,
"江苏":32,
"刘若英":40,
"江東":12,
"geovindu":32,
"english":22 }
dirkey=dirA.keys()&dirB.keys();
dirvalues=dirA.items()&dirB.items(); print("keys:")
print(dirkey);
print("values:")
print(dirvalues)

  

Python:dictionary的更多相关文章

  1. Python dictionary implementation

    Python dictionary implementation http://www.laurentluce.com/posts/python-dictionary-implementation/ ...

  2. Python dictionary 字典 常用法

    Python dictionary 字典 常用法 d = {} d.has_key(key_in)       # if has the key of key_in d.keys()          ...

  3. sort a Python dictionary by value

    首先要明确一点,Python的dict本身是不能被sort的,更明确地表达应该是"将一个dict通过操作转化为value有序的列表" 有以下几种方法: 1. import oper ...

  4. python : dictionary changed size during iteration

    1. 错误方式 #这里初始化一个dict >>> d = {'a':1, 'b':0, 'c':1, 'd':0} #本意是遍历dict,发现元素的值是0的话,就删掉 >> ...

  5. PythonStudy——Python字典底层实现原理 The underlying implementation principle of Python dictionary

    在Python中,字典是通过散列表或说哈希表实现的.字典也被称为关联数组,还称为哈希数组等.也就是说,字典也是一个数组,但数组的索引是键经过哈希函数处理后得到的散列值.哈希函数的目的是使键均匀地分布在 ...

  6. python dictionary的遍历

    d = {'x':1, 'y':3, 'z':2} for k in d:    print d[k] 直接遍历k in d的话,遍历的是dictionary的keys. 2 字典的键可以是任何不可变 ...

  7. Python dictionary 字典

    Python字典是另一种可变容器模型,且可存储任意类型对象,如字符串.数字.元组等其他容器模型. 一.创建字典字典由键和对应值成对组成.字典也被称作关联数组或哈希表.基本语法如下: dict = {' ...

  8. How to create a Python dictionary with double quotes as default quote format?

    couples = [ ['jack', 'ilena'], ['arun', 'maya'], ['hari', 'aradhana'], ['bill', 'samantha']] pairs = ...

  9. Python攻关之Django(一)

    课程简介: Django流程介绍 Django url Django view Django models Django template Django form Django admin (后台数据 ...

随机推荐

  1. ASP.NET MVC下使用AngularJs语言(一):Hello your name

    新春节后,分享第一个教程. 是教一位新朋友全新学习ASP.NET MVC下使用AngularJs语言. 一,新建一个空的Web项目.使用NuGet下载AngularJs和jQuery.二,配置Bund ...

  2. Android开发 - 解决DialogFragment在全屏时View被状态栏遮住的问题

    我的上一篇文章:设置DialogFragment全屏显示 可以设置对话框的内容全屏显示,但是存在在某些机型上顶部的View被状态栏遮住的问题.经过测试,发现了一种解决办法,在DialogFragmen ...

  3. “全栈2019”Java多线程第三十七章:如何让等待的线程无法被中断

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java多 ...

  4. JavaScript概述-第1章

    目录 初始JavaScript 学会使用编辑工具 如何引入脚本代码 常用语句 常见浏览器兼容性问题 了解前端开发技术JavaScript,JavaScript的发展,JavaScript特点,Java ...

  5. AndroidStudio制作个人资料界面模块以及SQLite数据库的使用

    前言 大家好,给大家带来AndroidStudio制作个人资料界面模块以及SQLite数据库的使用的概述,希望你们喜欢 学习目标 掌握SQLite数据库的使用,能够实现用数据库来保存用户的信息: 学会 ...

  6. 1,rocketmq 的原理与安装教程

    参考文档 http://blog.csdn.net/a19881029/article/details/34446629 https://github.com/alibaba/RocketMQ htt ...

  7. Java 9 被无情抛弃,Java 8 直接升级到 Java 10!!

    前几天写了一篇 Java 8 即将在 2019 年停止免费向企业提供更新的文章,企图迫使用户向更新一代的 Java 版本升级,但让人遗憾的是,小编今天收到了 Oracle Java 版本的升级推送,装 ...

  8. IdentityServer Token验证

    查看源码:https://github.com/IdentityServer/IdentityServer4/tree/release API使用Client Credentials的token验证是 ...

  9. Python编码和Unicode

    原文链接: ERIC MORITZ   翻译: 伯乐在线- 贱圣OMG译文链接: http://blog.jobbole.com/50345/ 我确定有很多关于Unicode和Python的说明,但为 ...

  10. 关于unity3d的ios帧频问题.

    原文:http://blog.csdn.net/spiritring/article/details/17606803 static void Start() { if (Application.pl ...