27 lines
672 B
Python
27 lines
672 B
Python
|
dotsfile = open('dots.txt', 'r')
|
||
|
wantedfile = open('wanted.txt', 'r')
|
||
|
|
||
|
def commandStrip(sentence):
|
||
|
for line in dotsfile:
|
||
|
line=line.strip('\n')
|
||
|
sentence = sentence.replace(line, "")
|
||
|
return sentence
|
||
|
|
||
|
def searchKeyWords(sentence):
|
||
|
found = []
|
||
|
for line in wantedfile:
|
||
|
line=line.strip('\n')
|
||
|
if sentence.find(line) >= 0:
|
||
|
found.append(line)
|
||
|
|
||
|
if found:
|
||
|
return found
|
||
|
return 1
|
||
|
|
||
|
temp = commandStrip("Guten tag, ich want you to pick up big red triangle.")
|
||
|
temp = searchKeyWords(temp)
|
||
|
if temp!=1:
|
||
|
print("I have found words: " + " ".join(temp))
|
||
|
|
||
|
dotsfile.close()
|
||
|
wantedfile.close()
|