-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulacion.py
38 lines (32 loc) · 1.19 KB
/
simulacion.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
def aaa():
with open("hola.txt", "r") as file:
a = file.readlines()
c = []
for i in a:
for j in range(30):
with open("chao.txt", "a") as file2:
file2.write(i)
def bbb():
with open("pasion.txt", "r") as file:
dicc = dict()
for linea in file:
datos = linea[:-1].split(";")
if datos[0] in dicc:
if datos[1] in dicc[datos[0]]:
dicc[datos[0]][datos[1]] += float(datos[3].replace(",", "."))
else:
dicc[datos[0]][datos[1]] = float(
datos[3].replace(",", "."))
else:
dicc[datos[0]] = dict()
dicc[datos[0]][datos[1]] = float(datos[3].replace(",", "."))
for j in dicc:
a = "Input@KoalaPesajeEntrada"
b = "Input@PaperPesajeEntrad"
c = "Input@BrightPesajeEntrada"
with open("salida.txt", "a") as file2:
e = str(int(dicc[j][c])).replace(".", ",")
f = str(int(dicc[j][a])).replace(".", ",")
g = str(int(dicc[j][b])).replace(".", ",")
file2.write("{};{};{};{}\n".format(j, e,f,g))
bbb()