习题8 打印,打印
2016-07-18 14:38
330 查看
formatter = "%r %r %r %r" print formatter % (1,2,3,4) print formatter % ("one","two","three","four") print formatter % (True,False,False,True) print formatter % (formatter,formatter,formatter,formatter) print formatter %( "I had this thing.", "That you could type up right.", "But it didn't sing.", "So I said goodnight." )
给出输出结果为
又是一种新的 print 用法格式
挺好,挺好
===========================================================================================================
附加练习
2单双引号的工作原理?
最后通用单引号,如果内有单引号的时候才用双引号。did't这里有个单引号了,所以那句话是双引号
注意字符串一般用%s,避免用%r。
%r是给调试的时候用的
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python将excel导入到mysql中
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法