Null in python?

26047
4
06-15-2012 04:29 AM
BartłomiejStaroń
New Contributor III
What is the equivalent of "null" in python to clean the column in calculate field?
I try use "None" ,but without any effect.
Tags (2)
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus
did you try two double quotes? ""
0 Kudos
ChrisBater
New Contributor II
None should not be in quotes.
0 Kudos
WilliamIde
New Contributor II
Null What?

None should work for Null pointers 

thing is an object.
if  thing == None :



thing is a string
one thing about strings however is users sometimes put man blank charagers in a string. So it looks empty  but "" will fail.  So you need to check thing.len() == 0 first.
if thing == "":
0 Kudos
ThaiTruong
Occasional Contributor II
check out this blog for dealing with null values  when using field calculator:
http://blogs.esri.com/esri/arcgis/2010/08/30/concatenate/

# Special case for null soiltype
if soil == '':
    return veg


Basically, you need to convert the value into string even if it's already a string.
0 Kudos