from bible import Bible import string import re #検索単語の入力 buf = input('探したい単語を入力:') #ファイル読込 try: text = Bible.read() except FileNotFoundError(): print('error') exit() #行単位での読込 arry = text.readlines() dic = {} pattren = "[0-9]+" #単語を辞書に登録 for row in arry: #lis = row.split() lis = re.split(' |\n|\'|-', row) for item in lis: item = item.translate(str.maketrans('', '', string.punctuation)) flag = re.fullmatch(pattren, item) if flag is None and item != '': if item in dic.keys():