Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arcpy.AddField_management(layerName, "BG10_INT", "LONG", 12, "", "", "", "NULLABLE", "")
- expression = "toInt(!BG10!)"
- codeblock = """def toInt(value):
- if value.isdigit():
- return int(value)
- else:
- return 0"""
- arcpy.CalculateField_management (layerName, "BG10_INT", expression, "PYTHON", codeblock)
- for row in rows:
- if row.BG10.isdigit():
- row.BG10_INT = int(row.BG10)
- else:
- row.BG10_INT = 0
- rows.updateRow(row)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement