signinlca
script to signin for volunteers at lca2015
In [80]:
import os
import time
import json
import getpass
In [81]:
def returndate():
return time.strftime(("%d" + "-" + "%b" + "-" + "%Y"))
def returntime():
return time.strftime("%H:%M:%S")
In [67]:
firnam = raw_input('first name: ')
lasnam = raw_input('last name: ')
tshir = raw_input('tshirt size: ')
cofvol = raw_input('coffee volc: ')
comen = raw_input('comments: ')
In [68]:
betdict = dict()
In [69]:
betdict.update({'first-name' : firnam})
betdict.update({'last-name' : lasnam})
betdict.update({'signin-date' : returndate()})
betdict.update({'signin-hrmin' : returntime()})
betdict.update({'tshirt-size' : tshir})
betdict.update({'coffees' : int(cofvol)})
betdict.update({'comments:' : comen})
In [70]:
betdict
Out[70]:
In [71]:
convj = json.dumps(betdict)
In [72]:
convj
Out[72]:
In [73]:
puser = getpass.getuser()
In [73]:
In [74]:
signpath = ('/home/' + puser + '/signinlca')
In [75]:
if os.path.isdir(signpath) == True:
print 'Path is there'
else:
print 'Path not there'
os.mkdir(signpath)
In [76]:
os.chdir(signpath)
In [90]:
opday = open(str(returndate()) + '.json', 'a')
In [89]:
opday.write(convj)
In [ ]: