A ChatGPT based emulation of the therapist Doctor Kernel from the book "A digital Affair" by Neora Shem Shaul
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

genlogs.py 597B

12345678910111213141516171819202122232425
  1. import chevron
  2. from glob import glob
  3. import os
  4. import json
  5. MAX_FILES = 20
  6. titles=json.load(open("logs/titles.json"))
  7. def title(filename):
  8. return titles.get(filename, filename.split('.')[0])
  9. def genlog():
  10. os.chdir('logs')
  11. filenames = list(reversed(sorted(glob("*.txt"))))[:MAX_FILES]
  12. files = [
  13. {"filename": f, "title": titles.get(f, f.split(".")[0])}
  14. for f in filenames
  15. ]
  16. with open('../logs.tmpl') as fin:
  17. with open('index.html','w') as fout:
  18. fout.write(chevron.render(fin, {"files": files}))
  19. if __name__ == '__main__':
  20. genlog()