hamentorwrite
Hamilton Mentor Write
Script to write login of Hamilton Computer Mentors.
Config file contains default hours (start time, end time), name, library, Looks up date. Asks for amount of people helped, type of help (tags - choose from popular choices), device helped with (tags - choose from popular choices), and comments.
Could the config file just be a json object?
import arrow
import json
import os
arnow = arrow.now()
thedate = str(arnow.date())
str(arnow.time())
startime = ('13:00:00')
endtime = ('15:00:00')
myname = input('Name: ')
mylib = ('GP')
typehelp = input('Type of help given: ')
devtype = input('Device: ')
fincomments = input('Comments: ')
anodict = dict()
defdict = {'name' : myname, 'startdatetime' : thedate + ' ' + startime, 'enddatetime' : thedate + ' ' + endtime,
'library' : 'GP', 'help count' : int(pplhelped), 'help' : typehelp, 'device' : devtype,
'comments': fincomments}
valddict = defdict.values()
valddict
What I want to do is take this dict and create columns out of the keys and rows of values under the column.
Could this perhaps works as an api - saving the latest as 0.
Create a json file that the json object is saved to. This script opens the json file and appends the new json object to it. It counts how many are already in the json file and assigns a +1 to it.
For now could just check hamcommen for amount of json objects and create a new +1
Not happy with creating lots of .json files in the folder, but whatever this will do for now.
lishamcomen = os.listdir('/home/wcmckee/hamcommen/')
lecomen = len(lishamcomen)
newlecom = lecomen + 1
wthamcom = open('/home/wcmckee/hamcommen/index' + str(newlecom) + '.json', 'w')
wthamcom.write(json.dumps(defdict))
wthamcom.close()
Comments
Comments powered by Disqus