标签:print 类型 格式 float strong color 顺序 类型转换 nbsp
name = input("name:") age = int(input("age:"))#intege整数 salary = float(input("salary:"))#浮点型
name = input("name:") age = int(input("age:"))#intege整数 salary = float(input("salary:"))#浮点型 msg = ‘‘‘ ---------info of %s-------------- name:%s age%d salary:%f ‘‘‘%(name,name,age,salary)#里面的%s等对应个数需要与这里一致,按照顺序排列 print(msg)
name = input("name:") age = int(input("age:"))#intege整数 salary = float(input("salary:"))#浮点型 msg = ‘‘‘ ---------info of {_name}-------------- name:{_name} age:{_age} salary:{_salary} ‘‘‘.format(_name = name, _age = age, __salary = salary) print(msg)
type()显示对应类型,int:整型 str:字符 float:浮点型
name = input("name:") age = int(input("age:"))#intege整数 salary = float(input("salary:"))#浮点型 print(type(name)) print(type(age)) print(type(salary)) str(age)#转换为string字符类型 print(type(age))
标签:print 类型 格式 float strong color 顺序 类型转换 nbsp
原文地址:http://www.cnblogs.com/cheng662540/p/8007055.html