#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\\yr2006\\mo12\\da5}' word_list = open(r'c:\wordlist.txt', 'r') for line in word_list: print line steno_entry = raw_input(r'steno:''') if steno_entry == ('[KW-EUT]'): break if steno_entry != ('[KW-EUT]'): continue 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) rtf_dic.write(dic_entry) rtf_dic.close() print 'Done'