mykonosman

Python Address Rd to rd runs, but does nothing

Discussion created by mykonosman on Dec 16, 2010
Latest reply on Jan 7, 2011 by zaloudek
I am trying to write a script that will find and replace a string in my adress field IF the adress City field is null.  The script runs with no errors, but when I go look at the table, nothing has been replaced.  Any ideas ?

gp.CalculateField_management(fc + "\\Parcels.shp", "SIT_FULL_S", "myfunction(!SIT_CITY!,!SIT_FULL_S!)", "PYTHON", "def myfunction(fld1,fld2):\n  if (fld1==None):\n    return fld2.replace('1 3Rd St', 'IT WORKS')\n  else:\n    return fld2")

Outcomes