PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tp-2/codigo/maketiempos_tex.py

http://tps-paradigmas.googlecode.com/
Python | 31 lines | 29 code | 2 blank | 0 comment | 4 complexity | 4990f9c65492197e097635785fa75622 MD5 | raw file
 1import os
 2import sys
 3
 4def create_time_tex(times):
 5    raw_data = open(times).read().strip()
 6    filas = [r.strip().split(',') for r in raw_data.split('\n')]
 7    pipes = "{|%s|}" % ("|".join(["l"] * len(filas[0])),)
 8    data = []
 9    for columnas in filas:
10        cs = " & ".join(columnas) + " \\\\\n\\hline\n"
11        data.append(cs)
12
13    data = "".join(data)
14    res = """
15    \\begin{table}
16        \\caption{Tiempos de resolucion de los tableros segun algoritmo}
17        \\begin{center}
18        \\begin{tabular}%(pipes)s
19\\hline
20%(data)s
21        \\end{tabular}
22        \\end{center}
23    \\end{table}
24    """
25    return res % locals()
26
27
28
29if __name__ == '__main__':
30    res = create_time_tex(sys.argv[1])
31    print res