let's assume that I have a resultset with a couple of fields. Now one of these fields is coming as 'NULL' or in Python language None. Now I need to create a method to replace whole Nones in a field by a specific word example 'UNKNOWN'. Here is my method.
def definegender(x):
if x is not None:
return x
else:
x = 'unknown'
return x
Now testing
z= None
definegender(z)
print('{}'.format(z))
Unfortunately, my approach does not work, please can you guys let me know the best way to create this validation. Thanks