1. %s  s = string  字符串

2. %d  d = digit  整数

3. %f  f = float  浮点数

#!/usr/bin/env python
#_*_coding:utf-8_*_
#date: 2018/1/13
#_author_="dingkai" name = input("your name:") age = input("your age:")
if age.isdigit(): #像不像数字
int(age)
else:
print('age must be int!')
exit(1) #退出程序 salary = input("your salary:")
if salary.isdigit(): #像不像数字
int(salary)
else:
print('salary must be int!')
exit(1) #退出程序 msg_info = '''
------info of %s ------
name: %s
age: %s
salary: %s
------end------
''' %(name,name,age,salary) print(msg_info)
05-28 19:55