Python中的打印输出函数,默认打印完后会换行(这一点与C语言不同),如果想让它不换行可以使用end=’’
print("hello world") # 输出结果 hello world
print(5, "也ok", 2.0) # 输出结果 5 也ok 2.0 (5与也有空格,k与2有空格)
a = 3.9
print(f"a是{a}") # 输出结果 a是3.9 (挺好用的)
for i in range(10): # range函数用法见于循环结构下的range
print(i, end='') # 输出结果 0123456789
print(type(a)) # 输出结果 <class 'float'>
print(a.__class__) # 输出结果 <class 'float'>(两者等效,有时可帮助查看一个对象的类型)
print("Teacher says:\"I'll call your mom if you are late again!\"")
# 输出结果 Teacher says:"I'll call your mom if you are late again!"