要在Python中打印内容,可以使用print()函数。以下是几个示例:
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.")
无论哪种方式,当代码执行时,打印的内容将显示在控制台上。