0

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?

Edited by Swift2: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Swift2
0

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

Edited by woooee: n/a

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.