rgthurau

Python won't recognize NULL (or None)

Discussion created by rgthurau on Sep 26, 2011
Latest reply on Mar 16, 2018 by luis.felipe.fragoso
Hi,
Trying to calculate a field based on another field. Want to give Contiguous a "Y" where Contig_ID is not NULL.

"Calculate Field for Contiguous"
Field Name: Contiguous

Expression: Answer(!Contig_ID!)

Code Block: 
def Answer(CI):
  if CI ==None:
    return "N"
  else:
    return "Y"


I've read plenty of posts explaining that NULL == None in python, but this code only returns Y for all numeric values in Contig_ID. Where Contig_ID == Null, no values are returned to Contiguous.

Any help would be grand!

Thanks

Rich

Outcomes