标签:info %s put print inpu format inf input style
1 name = input("name:") 2 age = input("age:") 3 salary = input("salary:") 4 # 格式化输出的三种形式 5 msg1 = ‘‘‘ 6 --------info of %s------- 7 name:%s 8 age:%s 9 salary:%s 10 ‘‘‘ %(name,name,age,salary) 11 12 msg2 = ‘‘‘ 13 --------info of {_name}------- 14 name:{_name} 15 age:{_age} 16 salary:{_salary} 17 ‘‘‘ .format(_name=name,_age=age,_salary=salary) 18 19 msg3 = ‘‘‘ 20 --------info of {0}------- 21 name:{0} 22 age:{1} 23 salary:{2} 24 ‘‘‘ .format(name,name,age,salary) 25 print(msg3)
标签:info %s put print inpu format inf input style
原文地址:https://www.cnblogs.com/doubleK24/p/11863263.html