Skip to content

Instantly share code, notes, and snippets.

@saludes
Created February 2, 2016 15:07
Show Gist options
  • Save saludes/4adf925b5c2a0c789c73 to your computer and use it in GitHub Desktop.
Save saludes/4adf925b5c2a0c789c73 to your computer and use it in GitHub Desktop.
Ompla la columna _competències_ a partir de la nota habitual
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