标签:格式 str inpu put python info nbsp form 格式化
name = input("name:")
age = int(input("age:"))
job = input("job:")
salary = input("salary:")
info = ‘‘‘
-------------info of ‘‘‘+ name +‘‘‘------------
name:‘‘‘+ name +‘‘‘
age:‘‘‘+ str(name) +‘‘‘
job:‘‘‘+ name +‘‘‘
salary:‘‘‘+ name +‘‘‘
‘‘‘
print(info)
info2=‘‘‘
-------------info of %s------------
name:%s
age:%d
job:%s
salary:%s
‘‘‘%(name,name,age,job,salary)
print(info2)
info3=‘’‘
-------------info of {_name}------------
name:{_name}
age:{_age}
job:{_job}
salary:{_salary}
‘‘‘.format(_name=name,
_age=age,
_job=job,
_salary=salary)
print(info3)
info4=‘‘‘
-------------info of {0}------------
name:{0}
age:{1}
job:{2}
salary{3}
‘‘‘.format(name,age,job,salary)
print(info4)
标签:格式 str inpu put python info nbsp form 格式化
原文地址:https://www.cnblogs.com/xiaoDK/p/14312794.html