ex8.py

# -*- coding:utf-8 -*-
formatter = "%s %s %s %s"  #理解%s 和%r 输出时的不同

print (formatter % (1,2,3,4))  
#python3.x与python2.x有一点区别,原来%(变量名,...)应该是加在print括号里
#如:print("who is the murder? %s or %s" % (a, b))
print (formatter % ("one","two","three","four"))
print (formatter % ("true", False, False, True)) #理解Fales 和 false 的不同,True 和 true的不同
print (formatter % (formatter,formatter,formatter,formatter))
print (formatter % (
     "i had this thing.",
     "that you could type up right.",
     "but it did't sing",
     "so i said goodnight"))

 

posted @ 2016-11-15 13:35  听风呤  阅读(100)  评论(0编辑  收藏  举报