ln = LectorNotasCSV('/tmp/listado.csv') with open("/tmp/listado.csv", 'r') as archivo: ll = archivo.readlines() def check_float(s): if re.match('^[0-9]+\.+[0-9]+$', s): return '{0:3.2f}'.format(float(s)) else: return s notas = open(os.path.join(BASE_DIR, 'FormatoNotas/notas.cvs'),'w') ltex = "%% ESTE ES EL ARCHIVO PARA LA TABLA \n" for ind,l in enumerate(ll[:-1]): lsep = l.split(',') if ind > 0: obs = ln.observaciones(ind - 1)[0] else: obs = 'Obs' ltex += '&'.join([check_float(c) for k,c in enumerate(lsep) if k not in list(range(3,14))+[17]]) +\ '&' + obs + "\\\\ \n \\hline \n" notas.write(ltex) notas.close()
notas = open(os.path.join(BASE_DIR, 'FormatoNotas/notas.cvs'), 'w') repor = open(os.path.join(BASE_DIR, 'FormatoNotas/reporte.cvs'), 'w') ltex = "%% ESTE ES EL ARCHIVO PARA LA TABLA \n" repor_str = " REPORTE ESTADISTICO \n" tot_desert = 0 tot_eval = 0 nsp = 0 abd = 0 apr = 0 rpb = 0 for ind, l in enumerate(ll[:-1]): lsep = l.split(',') if ind > 0: obs = ln.observaciones(ind - 1, nota_final=notas_finales_col)[0] if obs == 'APR': apr += 1 tot_eval += 1 elif obs == 'RPB': rpb += 1 tot_eval += 1 elif obs == 'ABD': abd += 1 tot_desert += 1 elif obs == 'NSP': nsp += 1 tot_desert += 1 else: obs = 'Obs'