New answers tagged

3

As @alexGIS mentioned, your expression will always fail because you're testing an integer against a string for equality. I also wanted to point out you can greatly simplify your code by eliminating the if statements and string formatting do the work for you: import arcpy def main(): inputParcels = arcpy.GetParameterAsText(0) targetParcels = ...


4

You need to remove the single quotes around your length comparison values, like this: if len(row[1]) == 2: The reason is that len() returns an integer value, and if your comparison value is surrounded by quotes, then that makes it a string. So even if returned value is 2, when you compare 2 == '2' python will return False.



Top 50 recent answers are included