是的,Python的print()
函数可以打印函数。你可以将函数名作为字符串传递给print()
函数,然后调用该函数。例如:
def my_function():
print("Hello, world!")
print("Calling the function:")
my_function()
输出:
Calling the function:
Hello, world!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:python print方法能否打印复数