I have this code that is throwing an error with exec, and I cant get it to work. It works when not in a function, though
def hashCheck(data):
exec("hashes = {'hi':'hi'}") #it was a file import before
print(hashes['hi']) #right here is error
try:
return(hashes[data]) #and here is also error
except KeyError:
import hashlib
m = hashlib.md5()
m.update(data)
return(m.hexdigest())
exec("hashes = {'hi':'hi'}")instead ofhashes = {'hi':'hi'}?!