0

I am trying to check first_item.rulename value is empty or null or starts with 'OptumFormulary' using below code

if (first_item.rulename != '' or first_item.rulename == None or first_item.rulename.startswith('OptumFormulary')):
       ruledefinitions_rules = ruledefinitions_rules[1:]
 else:
       ruledefinitions_rules = ruledefinitions_rules

My first_item.rulename value is '802' but still it is getting inside the if loop condition. enter image description here

In the snapshot, first_item.rulename is '802' on hovering.

User123
  • 793
  • 4
  • 10
  • 28
  • 2
    `first_item.rulename != ''` and it goes in the if – Phung Duy Phong Jan 08 '21 at 06:52
  • My bad. Sorry, didnt notice it. – User123 Jan 08 '21 at 06:53
  • 1
    Just a comment, but you might also want to adopt the habit of comparing with `None` using the `is` operator rather than `==` as explained for example here: https://stackoverflow.com/questions/3257919/what-is-the-difference-between-is-none-and-none/3257957#3257957 – robbo Jan 08 '21 at 09:59

0 Answers0