The bookstore from [this collection] (https://innokodakademija.com/collection/dnXtkLPZpX25t227q) is adamant in using eval(), but has moved the users dictionary into a function to prevent copying. The exists() function returns entries in users which match a given username. Create a query that copies users to res.
from re import *
param = "your text here"
def exists(name):
users = {
"alice": "password",
"bob": "password"
}
if not name.isalnum():
return {"Error": "No users found."}
return {
k:users[k] for k in users
if type(search("^%s$" % name, k)).__name__ == "SRE_Match"
}
res = eval("search("%s")" % param)
print(res) ➞ users
exists() function which doesn't appear here is test related and irrelevant.