from fastapi import FastAPI # 创建应用实例 app = FastAPI() # 写一个get接口 @app.get("/hello") def hello(): return {"msg": "你好,这是简易接口"} # @app.get() # 查询数据 # @app.post() # 新增数据 # @app.put() # 修改【全部】数据 # @app.patch() # 修改【部分】数据 # @app.delete() # 删除数据 #定义一个函数 # def hello(): # print("你好") #调用这个函数 # hello() from fastapi import FastAPI @app.get("/hello") def hello(): return {"msg":"你好"} # def hello(): # print("nihao") def a(): x=10 def b(): print(x) return b