""" encoding: UTF-8 @author:clx @file:pydantic_test.py @time:2023/5/29 22:55 """ import random import fastapi from starlette.responses import FileResponse # from fastapi.responses import FileResponse # from datetime import datetime # from typing import Optional, List # # from pydantic import BaseModel # from fastapi import FastAPI # # app = FastAPI() # # class User(BaseModel): # id:int # name:str = "Jone" # signup_ts = Optional[datetime] # friends:List[int] # # dic = { # "id":1, # "signup_ts":"2022-11-21", # "friends":[1,2,"3"] # } # user = User(**dic) # print(user.id) import os from pathlib import Path def fun(): f = os.path.join(r"./", "name") print(f) print(Path(f).name) fr = FileResponse( path=f, filename=Path(f).name ) # fun() # a = "dsadas.txt" # file_ext = os.path.splitext(a) # front,ext = file_ext # print(front,ext) # print("".join(random.sample("qwertyuiopasdfghjklzxcvbnm1234567890",5))) import time import re a = str(time.time()) b = re.sub(r"\.","",a) print(b)