# -- coding: utf-8 --
x = "There are %d types of people." % 10 # 因?yàn)橐脭?shù)字起宽,所以采用的%d
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s." % (binary, do_not)
# 引用字符串页屠,采用%s,如果用%r,上面就不能有引號淳衙,因?yàn)?r會(huì)全部引用
print x
print y
print "I said: %r." % x
# x是字符串署隘,而本句是需要引用帶引號的字符串宠能,所以用%r來講x全部引用,用%s的話磁餐,就引用不了引號了
print "I also said: '%s'." % y
# 與上句相反违崇,這句已經(jīng)有引號了,所以就用%s
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % hilarious
w = "This is the left side of..."
e = "a string with a right side."
print w + e # and關(guān)系诊霹,合并