I am having a little bit of a dilemma. I am having a problem with using getValue() and striping the value that is returned. For instance, take the following code.
import arcpy as ap mxd = ap.mapping.MapDocument("CURRENT") mylayer = ap.mapping.ListLayers(mxd, "Structures").name for row in ap.SearchCursor(mylayer): str = row.getValue("Struct_ID") newstr = str1.lstrip('0') if str == "662": print(str.lstrip('0'))
The error I get no matter what is:
Traceback (most recent call last): File "", line 9, in AttributeError: 'NoneType' object has no attribute 'lstrip'
The code works fine if you take out the newstr = str1.lstrip('0') line. The print(str.lstrip('0')) statement works fine. I just cannot use str.lstrip anywhere else in the code other then inside of print.
Anyone know what I am doing wrong or is it something to do with Esri?