标签:格式化输出 int ofo mat 输入 inpu format use pre
输入用户名和密码:
username=input("username:")
password=input("password:")
print(username,password)
格式化输出三种形式:
形式一(不用):
name=input("name:")
age=input("age:")
job=input("job:")
salary=input("salary:")
iofo1=‘‘‘
-------info of %s------
Name:%s
Age:%s
Job:%s
Salary:%s
‘‘‘%(name,name,age,job,salary)
print(iofo1)
形式二:
name=input("name:")
age=input("age:")
job=input("job:")
salary=input("salary:")
info2=‘‘‘
---------info of {_name}--
Name:{_name}
Age:{_age}
Job:{_job}
Salary:{_salary}
‘‘‘.format(_name=name,
_age=age,
_job=job,
_salary=salary)
print(info2)
形式三:
name=input("name:")
age=input("age:")
job=input("job:")
salary=input("salary:")
info3=‘‘‘
---------info of {0}---
Name:{0}
Age:{1}
Job:{2}
Salary:{3}
‘‘‘.format(name,age,job,salary)
print(info3)
标签:格式化输出 int ofo mat 输入 inpu format use pre
原文地址:https://www.cnblogs.com/shmilymima/p/9265456.html