__author__ = 'dell'

ab = {'Swaroop': 'swaroopch@byteofpython.info', 'Larry': 'larry@wall.org', 'Matsumoto': 'matz@ruby-lang.org',
'Spammer': 'spammer@hotmail.com'} print "Swaroop's address is %s" % ab['Swaroop'] # add a key/value pair
ab['Guido'] = 'guido@python.org' del ab['Spammer'] print "\nthere is %d contacts in the address-book\n" % len(ab)
for name, address in ab.items():
print 'contact %s at %s' % (name, address) if 'Guido' in ab:
print "\n Guido's address is %s" % ab["Guido"]

Python 字典 Print 格式化的更多相关文章

  1. Python中print格式化输出

    截取字符串输出,下面例子将只输出字符串的前3个字母 >>> str="abcdefg" >>> print "%.3s" % ...

  2. Python print函数用法,print 格式化输出

    原文地址:http://blog.csdn.net/zanfeng/article/details/52164124 使用print输出各型的 字符串 整数 浮点数 出度及精度控制 strHello ...

  3. [转载]Python print函数用法,print 格式化输出

    使用print输出各型的 字符串 整数 浮点数 出度及精度控制 strHello = 'Hello Python' print strHello #输出结果:Hello Python #直接出字符串 ...

  4. Python print格式化输出

    python中的print格式化输出,基本格式:"[字符串]%格式1[字符串]%格式2[字符串]....."%(string1,string2.....) 格式符号 ------- ...

  5. python print格式化输出。

    python print格式化输出. 1. 打印字符串 print ("His name is %s"%("Aviad")) 效果: 2.打印整数 print ...

  6. python字典

    1.字典解释 映射:通过名字来引用值得数据结构,字典是python中唯一内建的映射类型,字典中的值并没有特殊的顺序,都存储在一个特定的键下,键可以使数字.字符串.元组,通过查找某个特定键,就可以找到对 ...

  7. Python基础-字符串格式化_百分号方式_format方式

    Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This ...

  8. Python之print()函数

    1. 输出字符串 >>> str = 'Hello World' >>> print (str) Hello World 2. 格式化输出整数 支持参数格式化 &g ...

  9. Python 3.x 格式化输出字符串 % & format 笔记

    Python 3.x 格式化输出字符串 % & format 笔记 python格式化字符串有%和{}两种 字符串格式控制符. 字符串输入数据格式类型(%格式操作符号) %%百分号标记 %c字 ...

随机推荐

  1. Windows Media Player axWindowsMediaPlayer1 分类: C# 2014-07-28 12:04 195人阅读 评论(0) 收藏

    属性/方法名: 说明: [基本属性] URL:String; 指定媒体位置,本机或网络地址 uiMode:String; 播放器界面模式,可为Full, Mini, None, Invisible p ...

  2. ListView 分类: WinForm 2014-07-18 22:03 289人阅读 评论(0) 收藏

    一.ListView类(转载) 1.常用的基本属性: (1)FullRowSelect:设置是否行选择模式.(默认为false) 提示:只有在Details视图该属性才有意义. (2) GridLin ...

  3. HTML5 Shiv – 让该死的IE系列支持HTML5吧(转)

    摘自: http://www.cnblogs.com/yuzhongwusan/archive/2011/11/17/2252207.html HTML5能为我们做的事儿很多,最为可口的就是语义化标签 ...

  4. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(33)-数据验证共享

    原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(33)-数据验证共享 注:本节阅读需要有MVC 自定义验证的基础,否则比较吃力 一直以来表单的验证都是不可 ...

  5. c++截取屏幕图片并保存(函数代码实现)

    <strong> //获取桌面窗体的CDC CDC *pdeskdc = GetDesktopWindow()->GetDC(); CRect re; //获取窗体的大小 GetDe ...

  6. 微软ASP.NET网站部署指南(10):迁移至SQL Server

    1.  综述 第2章的部署SQL Server Compact和第9章的部署数据库更新里解释了为什么终于要升级到完整版SQL Server .本章节将告诉你怎样来做. SQL Server Expre ...

  7. 史上最简单的带流控功能的http server

    s.py import time import SimpleHTTPServer import SocketServer BYTES_PER_SECOND=160*1024 class MyHTTPR ...

  8. cidaemon.exe进程cpu占用率高及关闭cidaemon.exe进程方法

    问题描写叙述:   这段时间机器总是出现一个奇怪的问题:cidaemon.exe进程占用CUP率98%以上,大大影响了电脑的正常使用.资源管理器中出现多个cidaemon.exe进程,强制结束占用cp ...

  9. Linux Increase The Maximum Number Of Open Files / File Descriptors (FD)

    How do I increase the maximum number of open files under CentOS Linux? How do I open more file descr ...

  10. retain two decimal digits.

    package kju.o; import static kju.print.Printer.*; import java.text.*; class MathDemo { public static ...