Python “if X == Y and Z” syntax

Does this:

if key == "name" and item:

mean the same as this:

if key == "name" and if key == "item":

If so, I'm totally confused about example 5.14 in Dive Into Python. How can key be equal to both "name" and item? On the other hand, does "and item" simply ask whether or not item exists as a variable?

13
задан Andrew Medico 10 March 2016 в 00:46
поделиться