1

Below mentioned one is a part of my script.This is working when I assinged numbers for f.(Instead of "f" I have substitute 2.Then it is working).But i want to run this based on the no of rows of the table named "TL"(f).Can any one suggest a method to do this?

f=arcpy.GetCount_management(TL)
with arcpy.da.UpdateCursor(PCL_Info, ['PCL_PG_ID','PCL_IF_LN','PCL_IF_CN','PCL_IF_RM','PCL_IF_LU','PCL_IF_EL','globalid','created_user','created_date','last_edited_user','last_edited_date','adm_gn_ix']) as cursor:
 for row in cursor:
 for x in range(0,f):
 if(row[0] == parcel_ID[x]):
 c.append(row[0])
 c.append(row[1])
 c.append(row[2]) 
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 27, 2018 at 9:59
2
  • 1
    BERA's answer will solve your problem, but this double loop will be quite inefficient. It would probably work better with a dictionnary. Commented Nov 27, 2018 at 10:14
  • Hard to tell since we dont know what parcel_ID or c is, or the size of TL. parcel_ID could be a dictionary Commented Nov 27, 2018 at 10:26

1 Answer 1

3

Change:

f=arcpy.GetCount_management(TL)

To:

f=int(arcpy.GetCount_management(TL).getOutput(0))

Without getOutput, f is a Result object, not the actual count.

Example:

import arcpy
fc = r"C:\Test\Buildings.shp"
arcpy.GetCount_management(fc)
<Result '9'>
arcpy.GetCount_management(fc).getOutput(0)
'9'
int(arcpy.GetCount_management(fc).getOutput(0))
9
answered Nov 27, 2018 at 10:05
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.