I want my Python script to do something when two feature attribute values are None at the same time.

So I made this if statement: if feature["Name"] and feature["Zon"] is None:, but the code stops there and doesn't continue. Before the if statement I print both feature attribute values and get the following: (None, None). So the code should theoretically work, but it doesn't. What am I missing?


You need to explicitly state the condition twice so you could use:

if feature["Name"] is None and feature["Zon"] is None:
    # do something

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.