Created
March 19, 2015 00:52
-
-
Save urkh/6055b01fc375011b3bac to your computer and use it in GitHub Desktop.
utilidad para procesar archivos csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import sys | |
# periodo, cedula, carrera(200), materia, seccion(U), nota(EQ) | |
materias = ['EF3106', 'EF3301', 'EF3305', 'EF2420', 'EF2413', 'EF2415', 'EF2414', 'EF2417', 'EF2419', | |
'EF2418', 'EF1426', 'EF2404', 'EF2411', 'EF2408', 'EF2416', 'EF3302', 'EF2410', 'EF2403', 'EF3312', 'EF1424'] | |
f = open(sys.argv[1], 'rb') | |
print sys.argv[1] | |
print sys.argv[2] | |
try: | |
reader = csv.reader(f) | |
ofile = open('resultado_migrar.csv', "wb") | |
ofile.write("Periodo;Cedula;Carrera;Materia;Seccion;Nota\n") | |
rownum = 0 | |
for row in reader: | |
if rownum == 0: | |
pass | |
else: | |
row_cedula = row[0].split(";")[0] | |
for x in range(0, 20): | |
ofile.write(sys.argv[2] + ";" + row_cedula + ";200;" + materias[x] + ";U;EQ\n") | |
rownum += 1 | |
finally: | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment