【发布时间】:2021-04-14 06:51:21
【问题描述】:
def get_formatted_text(first,last):
full_name=(f'{first} {last}').title()
return full_name #only works with print. Why?
get_formatted_text('Dick','Long')
当我执行函数调用时,我在终端中看不到任何输出。它适用于打印功能,但我不明白为什么在返回显示输出时需要打印?
【问题讨论】:
-
因为
return不是print...不知道你在这里问什么。 -
好吧,没有
print()将不会打印任何内容。就这么简单。
标签: python function printing return