python-习题6~10
习题 6:字符串(string)和文本 x = "There are %d types of people."%10 binary = "binary" do_not= "don't" y = "Those who know %s and those who %s."%(binary,do_not) #定义变量,将要输出的内容存放到变量x,y, # binary,do_not. print x print y print "I said: %r."%x # ① print "I also said:'%s'."%y # ② hilarious = False joke_evaluation = "Isn't that joke so funny?!%r" # 定义变量 print joke_evaluation %hilarious # ③ ④ w = "This the left side of……" e = "a string with a right side." print w + e # ⑤ 运行结果: There are 10 types of people. Those who know binary and those who don't. I said: 'There are 10 types of people.'. # 变量x中的""变成了'' I also