要在Python中打印內(nèi)容,可以使用print()函數(shù)。以下是幾個(gè)示例:
print("Hello, World!")
name = "Alice"
print(name)
age = 25
print("My name is", name, "and I am", age, "years old.")
print("My name is {} and I am {} years old.".format(name, age))
print(f"My name is {name} and I am {age} years old.")
無(wú)論哪種方式,當(dāng)代碼執(zhí)行時(shí),打印的內(nèi)容將顯示在控制臺(tái)上。