username = input(" username:")
password = input(" password:")
print(username,password)
name = input("name:")
age = input("age:")
job = input("job:")
info ='''
---------info of %s-------
age:%s
job:%s
'''%(name,age,job)
print(info)
print(type(age))
这里的age是字符串类型的。要输入整形数据时需要进行强制类型转换。
name = input("name:")
age = int(input("age:"))
job = input("job:")
print(type(age))
info ='''
---------info of %s-------
age:%d
job:%s
'''%(name,age,job)
print(info)
name = input("name:")
age = int(input("age:"))
job = input("job:")
print(type(age))
info ='''
---------info of {_name}-------
age:{_age}
job:{_job}
'''.format(_name = name,
_age = age,
_job = job)
print(info)