-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_chart.py
43 lines (38 loc) · 1.22 KB
/
get_chart.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
38
39
40
41
42
43
from random import randint
def get_chart_list():
list_n = open('static/chart/data/chart_list_n.txt','r')
list_c = open('static/chart/data/chart_list_c.txt','r')
chart_n = list_n.readlines()
chart_c = list_c.readlines()
saida_n = []
saida_c = []
color = []
for lin in chart_n:
new_line = lin.split(',',1)
new_line[1] = new_line[1].replace("\n","")
new_line[1] = new_line[1].replace("[","")
new_line[1] = new_line[1].replace("]","")
cor = randint(0,255)
cor1 = randint(0,255)
cor2 = randint(0,255)
cores = []
cores.append(cor)
cores.append(cor1)
cores.append(cor2)
new_line.append(cores)
saida_n.append(new_line)
for lin in chart_c:
new_line = lin.split(',',1)
new_line[1] = new_line[1].replace("\n","")
new_line[1] = new_line[1].replace("[","")
new_line[1] = new_line[1].replace("]","")
cor = randint(0,255)
cor1 = randint(0,255)
cor2 = randint(0,255)
cores = []
cores.append(cor)
cores.append(cor1)
cores.append(cor2)
new_line.append(cores)
saida_c.append(new_line)
return [saida_n,saida_c]