首页 > 其他 > 详细

格式化输出

时间:2019-07-22 21:15:30      阅读:86      评论:0      收藏:0      [点我收藏+]
 

  

"""
name=input("please enter your name:")
hobby=input("please enter your hobby:")
job=input("please enter your job:")
msg="my name is %s hobby is %s job is %s" %(name,hobby,job)
print(msg)

"""
"""


name=input("please enter your name:")
hobby=input("please enter your hobby:")
job=input("please enter your job:")
msg="""--------information_of_%s-------
name : %s
hobby : %s
job : %s
-------------"""%(name,name,hobby,job)
print(msg)

"""
"""
#% 相当于占位符,s是指string,d时digit,是整数代表的是数字
#如果想要输出工作的进度,如3%,则需要再加一个%进行转义,例如
#对于%的转义,只需打两个%即可,它会把第一个%后的进行转义,若要表示%s则可以写为%%s

"""
name=input("please enter your name:")
hobby=input("please enter your hobby:")
job=input("please enter your job:")
msg="""--------information_of_%s-------
name : %s
hobby : %s
job : %s
job schedule : 6%%
-------------"""%(name,name,hobby,job)
print(msg)
"""

 

格式化输出

原文:https://www.cnblogs.com/GZ1215-228513-Chichy/p/11228273.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!