2. 输入输出
1. print()
输出到控制台
可打印字符串,数字以及变量值
print(12)
print("like")
print(x)
print(1,2,3)
2. print() 的格式化输出
print(format(12.12345, '6.2f'))
输出结果: 12.12
print(format(0.12345, '6.1%'))
输出结果: 12.3%
3. re = input(prompt)
re:返回值
prompt:提示字符
str = input("Please input a string:")
num = int(input("Please input a number:"))
float1 = float(input("Please input a float:"))
type(str):str
type(num):int
type(float1):floag
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。