首页 > 编程语言 > 详细

Python 格式化输出

时间:2020-06-26 00:08:37      阅读:87      评论:0      收藏:0      [点我收藏+]
 1 #!/usr/bin/env python
 2 # Author: Andy Song
 3 # date: 2020/6/25
 4 # 占位符: %s: string, %d: digit, %f: float
 5 
 6 name = input("Your Name Is: ")
 7 gender = input("Your Gender Is: ")
 8 age = int(input("Your Age Is: "))
 9 job = input("Your Job Is: ")
10 ID = int(input("Your ID Is: "))
11 
12 
13 msg = ‘‘‘
14 
15 ------------------- Info of %s ---------------------
16 
17 Name: %s
18 Gender: %s
19 Age: %d
20 Job: %s
21 ID: %d
22 
23 ------------------- End -----------------------------
24 
25 ‘‘‘ %(name, name, gender, age, job, ID)
26 
27 print(msg)

 

Python 格式化输出

原文:https://www.cnblogs.com/andysongtech/p/13193501.html

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