#userdict0.py

import json
from userdict0cl import D

dname=str(input('select dictionary name: '))
dname= D()

while True:
	keyy=str(input('enter key: '))
	if keyy =='':
		break
	else:
		vall = str(input('enter value: '))
	dname.fill(keyy,vall)
dname.printall()

saveyesno=str(input('want to save dictionary? [y/n] '))
if saveyesno =='n' or saveyesno =='':
	print('ok.')
else:
	txt=str(input('enter file name. '))
	txtfile = txt+'.json'
	print('you\'re file is: ' + txtfile)
	dname.write_items(txtfile)
	print('well done.')
	dname.print_json()
