006_字符串的格式化输出
2017-10-14 本文已影响0人
Nzkalhbxx
# __author__:Nzkalhbxx
# __date__:2017/10/11\
name = input("name: ")
age = input("age: ")
classes = input("classes: ")
favorite = input("favorite: ")
'''s为字符串的占位符,% (args[]...)
%s s = string
%d d = digit(整数)
%f f = float(浮点数)
'''
# print("my name is: %s age is: %s" % (name, age))
msg = """
--------------%s's information---------------
name: %s
age: %s
class: %s
favorite: %s
---------------------end---------------------""" % (name, name, age, classes, favorite)
print(msg)
运行结果