为什么我的 Flask API 在 html 中返回 none

Why is my Flask API returning none in the html

我在理解 Flask API 以及 return 所需信息时遇到了问题。我可以打印数据,例如:

crunchbaseNY = crunchbase[crunchbase['city'] == 'New York']
print(crunchbaseNY)

但是当放入 Flask 时它被 returned 为 'None'

from flask import Flask, render_template
app = Flask("MyApp")

@app.route('/')
def hello_world():
    output = print(crunchbaseNY)
    return render_template('index.html', result=output)
    #return output
    
app.run(host='localhost', port=5001)

你做到了

output = print(crunchbaseNY)

print 做打印和return None,请改成

output = str(crunchbaseNY)