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.

field calculator image

This worked within the field calculator.field calculator

2 Answers 2


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


if Name=="*Emergent*":


if "Emergent" in Name:

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'

Your Answer

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

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