Skip to main content
2 of 3
Made title better match question
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm new to python

expression = "crossing(!CROSS_ROW!,!ROW_SCORE!)"

codeblock = """def crossing(crosses, row_score):
            if crosses != 0:
                return 5
            else:
                return row_score"""

The code gives a score to pipes (from pipe layer) that cross, or passes next to roads (from road layer) depending on the width of the road. this was the code-block that assigned a score of 5 if the pipe crosses.

Solaire
  • 151
  • 2
  • 2
  • 12