No Description

matricula.py 881B

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. import sys
  3. import json
  4. path = "C:/Users/danie/Documents/Projects/Companion App/server/Matricula Parse"
  5. dirsem = os.listdir(path)
  6. def orderFiles(files):
  7. i = 1
  8. for file in dirsem:
  9. if file.endswith('.json'):
  10. files.append({'file': file, 'num': i})
  11. i += 1
  12. return files
  13. files = orderFiles([])
  14. # for file in files3:
  15. # check = file['file'].split('.')
  16. # path = "C:/Users/diego/Documents/companion_app/segundo_sem" if check[0][-1] == '2' else "C:/Users/diego/Documents/companion_app/primer_sem"
  17. # with open(path + '/' + file['file']) as f:
  18. # data = json.load(f)
  19. # fac_id = file['num']
  20. # for key in data:
  21. # if key != 'Horario ':
  22. # code = key
  23. # name = data[key][0]
  24. # creds = data[key][1]
  25. # print(code, name, creds, fac_id)