Simple string problem

513
2
Jump to solution
06-19-2013 05:59 AM
StormwaterWater_Resources
New Contributor III
I can't believe I'm posting for this, it has to be something really stupid that I'm missing.  I have the following:
Exclude    = ['shape_area','shape_length','globalid','Shape.len'] field_list = [f.name for f in arcpy.ListFields(in_fc)               if f.name.lower() not in Exclude]

The in_fc that I'm feeding it has both a GlobalID field and a Shape.len field.  At the end of the code above field_list does not contain GlobalID, but it does contain Shape.len.  I tried (for no good reason other than voodoo) to raw (r'Shape.len') and unicode (u'Shape.len') the string to no effect (same for "" which my perl-centric brain forced me to do even though it knew better for Python).

What am I missing here?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
I think you would want to change it to:

Exclude    = ['shape_area','shape_length','globalid','shape.len']


You had the 'S' capitalized, but in your list comprehension you are casting all field names to lower case for matching.

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable
I think you would want to change it to:

Exclude    = ['shape_area','shape_length','globalid','shape.len']


You had the 'S' capitalized, but in your list comprehension you are casting all field names to lower case for matching.
0 Kudos
StormwaterWater_Resources
New Contributor III
I think you would want to change it to: 

Exclude    = ['shape_area','shape_length','globalid','shape.len']


You had the 'S' capitalized, but in your list comprehension you are casting all field names to lower case for matching.


OMG, I so wish I could delete threads....
0 Kudos