标签:拼接 nbsp 浮点 roc 字符串格式化 with -- python字符串 print
字符串格式化输出 :
字符串的拼接第一种方式
如:name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")
info = ‘‘‘
-------- info of ‘‘‘ + name+‘‘‘------
name:‘‘‘ + name + ‘‘‘
age:‘‘‘ + age + ‘‘‘
job:‘‘‘ + job +‘‘‘
salary:‘‘‘ +salary +‘‘‘
‘‘‘
print(info)
运行
name:alxs
age:32
job:ij
salary:das
-------- info of alxs------
name:alxs
age:32
job:ij
salary:das
Process finished with exit code 0
第二种方式:
name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")
info = ‘‘‘
-------- info of %s-----
name:%s
age:%s
job:%s
salary:%s
‘‘‘ %(name,name,age,job,salary)
print(info)
(注:%s标示字符串string,%d数字,%f浮点)
标签:拼接 nbsp 浮点 roc 字符串格式化 with -- python字符串 print
原文地址:http://www.cnblogs.com/yunzhidian/p/7993268.html