一個簡單服務器程式,訪問根路徑的時候,呼叫hello函式,
代碼如下:
from flask import Flask class app1: def __init__(self, name): self.app = Flask(name) # 根路徑, 呼叫hello函式 @self.app.route("/") def hello(): return "hello world" win1 = app1("hello") if __name__ == '__main__': win1.app.run()
讀書和健身總有一個在路上
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/144259.html
標籤:Python
上一篇:Python基礎-03字串
