Python中的打印输出函数,默认打印完后会换行(这一点与C语言不同),如果想让它不换行可以使用end=’’

    1. print("hello world") # 输出结果 hello world
    2. print(5, "也ok", 2.0) # 输出结果 5 也ok 2.0 (5与也有空格,k与2有空格)
    3. a = 3.9
    4. print(f"a是{a}") # 输出结果 a是3.9 (挺好用的)
    5. for i in range(10): # range函数用法见于循环结构下的range
    6. print(i, end='') # 输出结果 0123456789
    7. print(type(a)) # 输出结果 <class 'float'>
    8. print(a.__class__) # 输出结果 <class 'float'>(两者等效,有时可帮助查看一个对象的类型)
    9. print("Teacher says:\"I'll call your mom if you are late again!\"")
    10. # 输出结果 Teacher says:"I'll call your mom if you are late again!"

    image.png