Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

List of fields

$
0
0
Hallo!

I need to check if a feature class includes a field called 'unwanted_field' and then delete it. I've been trying to accomplish that with an if statement on a field list gained by the arcpy.ListFields tool, but with no success. If I type in my 10.2.1 ArcMap Python window next code:

arcpy.ListFields('my_feature_class')

I get the following result:

[<Field object at 0x57483b0[0x623f860]>, <Field object at 0x5748290[0x623ff20]>, <Field object at 0x57485b0[0x623fd10]>, <Field object at 0x114465d0[0x623ff80]>, <Field object at 0x5742ff0[0x623fda0]>, <Field object at 0x587d570[0x623f650]>, <Field object at 0x11446670[0x623fa10]>, <Field object at 0x11446630[0x623fea8]>]

even though my_feature_class includes 8 fields named: OBJECTID, SHAPE, Shape_Length, etc.

What am I doing wrong?

Thanks in advance,
Gašper

Viewing all articles
Browse latest Browse all 2485

Trending Articles