Created
February 2, 2016 15:07
-
-
Save saludes/4adf925b5c2a0c789c73 to your computer and use it in GitHub Desktop.
Ompla la columna _competències_ a partir de la nota habitual
This file contains 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 sys, locale | |
locale.setlocale(locale.LC_ALL, 'es_ES.UTF-8') | |
if __name__ == '__main__': | |
inPath, outPath = sys.argv[1:3] | |
with open(outPath, 'w') as outf: | |
with open(sys.argv[1]) as inf: | |
for row in inf.readlines(): | |
studentId,sgrade,extra = row.split(' ') | |
assert extra == '\n' | |
grade = locale.atof(sgrade) | |
comp = 'S' if grade >= 5 else 'N' | |
outf.write( "%s %s\n" % (studentId, comp)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment