摘要:
from typing import Optional from fastapi import FastAPI from pydantic import BaseModel # 用来声明请求体的库:1.提供运行时类型信息;2.返回友好错误提示 app = FastAPI() class Item(B 阅读全文
posted @ 2022-01-26 11:19
Tarzen
阅读(163)
评论(0)
推荐(0)
摘要:
This module provides runtime support for type hints。 下面的函数接收与返回的都是字符串,注解方式如下: def greeting(name: str) -> str: return name greeting 函数中,参数 name 的类型是 st 阅读全文
posted @ 2022-01-26 10:48
Tarzen
阅读(471)
评论(0)
推荐(0)
摘要:
创建一个main.py文件 查看代码 from typing import Optional from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @a 阅读全文
posted @ 2022-01-26 10:21
Tarzen
阅读(256)
评论(0)
推荐(0)

浙公网安备 33010602011771号