import threading
import queue
dictionary = 'pass.txt'
password = 'chicken'
def checkPass(anyPass):
global password
if anyPass == password:
print('The password is :'+ str(anyPass))
else:
print('Its not: ', anyPass )
def worker():
while True:
work = q.get()
checkPass(work)
q.task_done()
q = queue.Queue()
for i in range(2):
t = threading.Thread(target = worker)
t.daemon = True
t.start()
with open('pass.txt','r') as file:
for line in file:
q.put(line)
print('Waiting for a coincidece')
q.join()
print('Finish')
It dont throw error but its not doing what it should..telling me when a word in the queue is equal to my variable password. Anyone have an idea of whats going on there, or what im doing wrong?

New Topic/Question
Reply



MultiQuote




|