标签:core 输出 oem coding for please inf aaa format
# 格式化输出
# % s d
# name = input("please input your name : ")
# age = input("please input your age : ")
# job = input("please input your job : ")
# # msg = ‘我叫%s , 今年%s‘ %(name,age)
# # print(msg)
#
#
#
# # %% 两个%%是为了转义 % 否则直接写57% 会报格式错误
#
# msg1 = ‘‘‘-----------------info of %s
# name : %s
# age : %s
# job : %s
# score : 56%%
# --------------------------end of poem
#
# ‘‘‘% (name,name,age,job)
# print(msg1)
# 另外一种格式化输出 format
s2 = "my name is {},this year is {},my hobby is {},i love {}".format(‘smith‘,‘2019‘,‘coding‘,‘coding‘)
print(s2)
s3 = "my name is {0},this year is {1},my hobby is {2},i love {1}".format(‘smith‘,‘2019‘,‘coding‘,‘coding‘)
print(s3)
s4 = "my name is {aaa},this year is {name},my hobby is {age},i love {age1}".format(name=‘smith‘,age=‘2019‘,age1=‘coding‘,aaa=‘coding‘)
print(s4)
标签:core 输出 oem coding for please inf aaa format
原文地址:https://www.cnblogs.com/rookieagle/p/10269860.html