-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse.py
37 lines (34 loc) · 1.63 KB
/
parse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Parse:
def ParseCountryData(wdata, i):
a = (wdata["response"][i]["continent"])
b = (wdata["response"][i]["country"])
c = (wdata["response"][i]["population"])
return (f'\nContinente: {a}\nPaís: {b}\nPopulação: {c}')
def ParseFirstData(wdata, i):
d = (wdata["response"][i]["cases"]["new"])
e = (wdata["response"][i]["cases"]["active"])
f = (wdata["response"][i]["cases"]["critical"])
g = (wdata["response"][i]["cases"]["recovered"])
h = (wdata["response"][i]["cases"]["total"])
return (f"\n\nNovos casos: {d}\nCasos ativos: {e}\nCasos críticos: {f}\nRecuperados: {g}\nCasos Totais: {h}\n\nMortes Totais: {i}\n")
def ParseSecondData(wdata, i):
i1 = (wdata["response"][i]["deaths"]["total"])
j = (wdata["response"][i]["deaths"]["new"])
return (f'Mortes Totais: {i1}\nMortes no período: {j}\n\n')
class ParseCsv:
def ParseCountryData(wdata, i):
a = (wdata["response"][i]["continent"])
b = (wdata["response"][i]["country"])
c = (wdata["response"][i]["population"])
return (f'{a},{b},{c},')
def ParseFirstData(wdata, i):
d = (wdata["response"][i]["cases"]["new"])
e = (wdata["response"][i]["cases"]["active"])
f = (wdata["response"][i]["cases"]["critical"])
g = (wdata["response"][i]["cases"]["recovered"])
h = (wdata["response"][i]["cases"]["total"])
return (f"{d},{e},{f},{g},{h},")
def ParseSecondData(wdata, i):
i1 = (wdata["response"][i]["deaths"]["total"])
j = (wdata["response"][i]["deaths"]["new"])
return (f'{i1},{j}\n')