#__author:"hanhankeji" #date: 2019/11/22 name = input("Name>>:") age = int(input("Age>>:")) job = input("Job>>:") salary = input("Salary>>:") msg = ‘‘‘ --------infp of %s-------- Name: %s Age : %d Job : %s Salary: %d You will be retired in %s years! ---------------end------------- ‘‘‘ % (name,name,age,job,salary,65-age) # if salary.isdigit(): #判断输入的工资是不是长得像数字 # salary = int(salary) # else: # #print("must input digit!") # exit("must input digit!") #退出程序! # %s = string 字符串 # %d = digit 整数 # %f = float 浮点数 约等于小数 print (msg)
格式化输出
C:\Users\DELL\AppData\Local\Programs\Python\Python37\python.exe F:/Users/DELL/PycharmProjects/fullsack_S1/first1/day1/格式化输出.py Name>>:hanhankeji Age>>:35 Job>>:it Salary>>:8000 --------infp of hanhankeji-------- Name: hanhankeji Age : 35 Job : it Salary: 8000 You will be retired in 30 years! ---------------end------------- 进程已结束,退出代码0
原文:https://www.cnblogs.com/hanhankeji/p/11913531.html