Currently I have this code:

if any(w in itemname for w in ("Password","User","Server")):
   entry.setvalue(myutils.password_recover(itemvalue))

And I want "E-mail To" to also be a string next to "Server" .. However, if I add "To" then it picks up EVERYTHING that has the letters 'to' .

If I add "E-mail To" then it also picks up everything with both of those words..

What's the correct quotations or way to represent case sensitivity, and for it to match the entire string, not part of the string?

There is no way to get it to match anything other than the entire string, so there is another problem with the program logic, i.e. you are telling it something different.

itemname = ["email to", "password", "user"]
for w in ("Password","User","Server", "to", "email", "Email to"):
    if w.lower() in itemname:
        print "%-25s" % (w+" Found")
    else:
        print "%25s Not Found" % w

Meh, I found it easier to just rename all instances of "E-mail To" in my entire program to "E-mail T0o" -- a unique identifier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.