AnsweredAssumed Answered

Multiple replacements with Field Calculations using Python

Question asked by phiddler on Aug 26, 2015
Latest reply on Aug 26, 2015 by bixb0012

I am able to make replacements one at a time following these instructions:

Simple calculations

Simple string examples

Strings are supported by a series of Python string functions, including capitalize, rstrip, and replace.

Replace any occurrences of "california" with "California" found in the field STATE_NAME.

!STATE_NAME!.replace("california", "California")

How do I make several replacements at a time? For example, how do I change “california” and “cal” and “CA” and “Cal” to “California” and “florida” and “fla” and “FL” and “Fla” to “Florida” without having to create a new field for STATE NAME for each individual replacement?

Thanks, Len Springer