ammaan commited on
Commit
3390ce8
1 Parent(s): 3e2f53b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -2
main.py CHANGED
@@ -1,10 +1,22 @@
1
  from typing import Union
2
-
3
  from fastapi import FastAPI
4
 
5
  app = FastAPI()
 
 
 
 
 
 
 
 
 
 
 
 
6
  listt = "hellow world how are you are yo good "
7
  @app.get("/")
8
  def read_root():
9
- return {"Hello": listt}
10
 
 
1
  from typing import Union
2
+ import csv
3
  from fastapi import FastAPI
4
 
5
  app = FastAPI()
6
+
7
+ def load_data(filename):
8
+ myList = []
9
+ with open(filename) as numbers:
10
+ numbers_data = csv.reader(numbers,delimiter=',')
11
+ next(numbers_data) #skip the header
12
+ for row in numbers_data:
13
+ myList.append(row)
14
+ return myList
15
+
16
+
17
+ new_list = load_data('country.csv')
18
  listt = "hellow world how are you are yo good "
19
  @app.get("/")
20
  def read_root():
21
+ return {"Hello": new_list}
22