This is my code
index_dictionary = dict()
with open("BIBLE.txt") as Bible:
count = 0
for line in Bible:
index = line[:8].split()
Book = index[0].strip().upper()
chapter, verse = list(map(str.strip, index[1].split(":")))
index_dictionary[(Book, chapter, verse)] = count
count += len(line)
Bible = open("BIBLE.txt")
while True:
search_engine = input(
"Book list: Ge(Genesis), Ex(Exodus), Le(Leviticus), Nu(Number), De(Deuteronomy), "
"Jos(Joshua) \n "
"jg(Judges)"
"(or x to exit) \n"
"Input Book(Abbreviation only!):Chapter:verse \n "
)
if search_engine == "x":
print("see you next time")
break
Book, chapter, verse = list(map(str.strip, search_engine.split(":")))
keyword = (Book.upper(), chapter, verse)
if keyword in index_dictionary:
#Bible.seek(index_dictionary)
bible = Bible.readline()
print(bible)
Bible.close()
I get reference from this https://www.daniweb.com/programming/software-development/threads/460206/parsing-bible-for-specific-verses
There is a few problem, first, it did not print what I want it too, it only print Ge:1:1 the first time, the second time you print you get Ge:1:2, even if you put Joh:3:16 you will still get Ge:1:1 I dont know anymore. Can someone help me? And If i put Bible.seek(index_dictionary) it will got error code '<' not supported between instances of 'dict' and 'int'
Thanks in advance