Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Tweeted twitter.com/#!/StackGIS/status/520107398716223488
Made title better match question
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Python / Arcgis: What does the Meaning of exclamation mark meanin Python parser of ArcGIS Field Calculator?

Post Migrated Here from stackoverflow.com (revisions)
Source Link
Solaire
  • 151
  • 2
  • 2
  • 12

Python / Arcgis: What does the exclamation mark mean?

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.