Python 格式化输出

2021-05-05 01:30

阅读:628

标签:you   auth   put   input   class   int   pre   python   code   

 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 格式化输出

标签:you   auth   put   input   class   int   pre   python   code   

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


评论


亲,登录后才可以留言!