python

python print方法能否打印函数

小樊
81
2024-09-25 07:46:11
栏目: 编程语言

是的,Python的print()函数可以打印函数。你可以将函数名作为字符串传递给print()函数,然后调用该函数。例如:

def my_function():
    print("Hello, world!")

print("Calling the function:")
my_function()

输出:

Calling the function:
Hello, world!

0
看了该问题的人还看了