gpt4 book ai didi

python-3.x - 返回语句不在 Flask 中输出结果

转载 作者:行者123 更新时间:2023-12-03 16:10:03 24 4
gpt4 key购买 nike

我编写了这段代码,主要是我希望结果打印出值,并结合字符串和换行符。我也试图避免在 () 中得到结果。然而,似乎我遗漏了一些东西,因为结果什么也没打印出来。我知道使用打印功能,但问题是这样的。该函数实际上是在 Flask html 页面中呈现的。当调用 html 页面时,使用 Print 结果会输出“None”。或者,如果有另一种使用 Print 并能够渲染它的解决方法。这是代码草稿。

def testline():
str1 = 'result'
str2 = 'devastating'
str3 = 'Filling Wao: '

return "The {0} for the current year is {1} \n Definition: {2} \n Wao".format(str1, str2, str3)
testline()

任何帮助将不胜感激。

最佳答案

result = testline()
print(result)

应该可以!

关于python-3.x - 返回语句不在 Flask 中输出结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51725134/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com