from typing import Union import csv from fastapi import FastAPI app = FastAPI() def load_data(filename): myList = [] with open(filename) as numbers: numbers_data = csv.reader(numbers,delimiter=',') next(numbers_data) #skip the header for row in numbers_data: myList.append(row) return myList new_list = load_data('country.csv') listt = "hellow world how are you are yo good " @app.get("/") def read_root(): return {"Hello": new_list}