Skip to content

Instantly share code, notes, and snippets.

@helloIAmPau
Last active December 17, 2015 15:59
Show Gist options
  • Save helloIAmPau/5635479 to your computer and use it in GitHub Desktop.
Save helloIAmPau/5635479 to your computer and use it in GitHub Desktop.
#! /bin/env/python
in_file = open("intestatari.txt", "r");
out_file = open("fase1.txt", "w");
c = 1;
while True:
line = in_file.readline();
if line == "":
break;
elif "Tabella" in line:
continue;
elif "Pagina" in line:
in_file.readline();
in_file.readline();
elif not line.strip():
continue;
else:
out_file.write(line);
in_file.close();
out_file.close();
in_file = open("fase1.txt", "r");
out_file = open("fase2.txt", "w");
c = 1;
while True:
line = in_file.readline();
if line == "":
break;
if c == 2:
line = line.rstrip('\r\n') + " ";
if c == 3:
line = line.rstrip('\r\n');
if c == 4:
c = 0;
out_file.write(line);
c = c + 1;
in_file.close();
out_file.close();
c = 0;
r = 0;
in_file = open("fase2.txt", "r");
out_file = open("final2.tex", "w");
endTableLine = '''
\\clearpage
'''
newblock = "\multirow{5}{*}\n"
address = "80021 Afragola (NA) & 80021 Afragola (NA) & 80021 Afragola (NA)\\\\ \n"
row = 0;
column = 0;
while True:
out_file.write("\\begin{minipage}[t][1.4in][t]{2.7in}\n");
line = in_file.readline();
if line == "":
break;
out_file.write(line.rstrip("\r\n") + "\\\\" + "\n");
line = in_file.readline();
if line == "":
break;
out_file.write(line.rstrip("\r\n") + "\\\\" + "\n");
out_file.write("80021 Afragola (NA)\n\\end{minipage}\n");
if row == 23:
out_file.write(endTableLine);
row = -1;
if column == 2:
out_file.write("\n");
column = -1;
row = row + 1;
column = column + 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment