#r'c:\' #File name: bozzypy.py import string import os import time rtf_dic = file(r'c:\bozzy.rtf','a') boilerp_head = '''{\\rtf1\\ansi{\\*\\cxrev100}\\cxdict{\\*\\cxsystem Digital CAT 00214 RTF by Stenovations, Inc.}\\deff0{\\fonttbl {\\f0\\fmodern Courier New;}}{\\stylesheet{\\s0 Normal;}{\\s1 Question; }{\\s2 Answer;}{\\s3 Colloquy;}}{\\*\\cxtranopt\\numbar}''' rtf_dic.write(boilerp_head) boilerp_pre = '{\\*\\cxs ' boilerp_post = '{\\*\\cxsvatdictentrydate\\' boilerp_time = time.strftime('\\yr%Y\\mo%m\\da%d') word_list = open(r'c:\wordlist.txt', 'r+') for line in word_list.readlines(): print line steno_entry = raw_input(r'steno:''') if steno_entry == ' quit': break if steno_entry == ' skip': continue def rtf_convert(steno_entry): steno_entry = steno_entry.replace(r'] [',r'/') steno_entry = steno_entry.replace(r'[','') steno_entry = steno_entry.replace(r']','') dic_entry = os.path.join(boilerp_pre + steno_entry + r'}' + line + boilerp_post + boilerp_time + '}') rtf_dic.write(dic_entry) def again_loop(): entry_status = True while entry_status == True: global steno_entry print steno_entry + line steno_entry = raw_input(r'steno:''') print steno_entry + line decide_entry = raw_input(r'next, again, delete:''') if decide_entry == ' next': rtf_convert(steno_entry) entry_status = False elif decide_entry == ' again': rtf_convert(steno_entry) continue elif decide_entry == ' delete': delete_loop() entry_status = False def delete_loop(): entry_status = True while entry_status == True: global steno_entry print steno_entry + line steno_entry = raw_input(r'steno:''') print steno_entry + line decide_entry = raw_input(r'next, again, delete:''') if decide_entry == ' next': rtf_convert(steno_entry) entry_status = False elif decide_entry == ' again': rtf_convert(steno_entry) again_loop() entry_status = False elif decide_entry == ' delete': continue print print steno_entry + line decide_entry = raw_input(r'next, again, delete:''') if decide_entry == ' quit': break elif decide_entry == ' next': rtf_convert(steno_entry) elif decide_entry == ' again': rtf_convert(steno_entry) again_loop() elif decide_entry == ' delete': delete_loop() rtf_dic.close() print 'Done'