Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to find part of a text string in the CLASS_NAME field and return a text string to the Abrv_Name field using the Field Calculator in ArcGIS 10 via a Python parser.

Here is what I have tried among other things with no success. Any ideas would be appreciated.

field calculator image


This worked within the field calculator.field calculator

share|improve this question
add comment

2 Answers 2

If you are specifically looking for wildcard behavior (probably not in this case) you can try the fnmatch module. Example:

from fnmatch import fnmatch

if fnmatch(Name, "*Emergent*"):
    return 'EM'
share|improve this answer
add comment

You want the in method detailed here: http://docs.python.org/reference/expressions.html#in

Swap

if Name=="*Emergent*":

with

if "Emergent" in Name:
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.