Select to view content in your preferred language

'Is Null' in Python

10801
3
Jump to solution
08-13-2014 09:59 AM
HemantAngarkar2
Occasional Contributor

I am trying to use field calculator where values will be taken from one field of two fields with if condition. If first field is null then value will be taken from second field. In VB there is 'is Null' keyword. What is there in Python?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JasonScheirer
Regular Contributor II

You can use

value is None

For example, in your expression you can do

!field1! if not !field1! is None else !field2!

alternately just do

!field1! or !field2!

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus
JasonScheirer
Regular Contributor II

You can use

value is None

For example, in your expression you can do

!field1! if not !field1! is None else !field2!

alternately just do

!field1! or !field2!