From the course: Learning ArcGIS Python Scripting (2018)
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Use variables to make scripts flexible - ArcGIS Tutorial
From the course: Learning ArcGIS Python Scripting (2018)
Use variables to make scripts flexible
- [Instructor] A variable is a placeholder for a value. Variables can hold text strings such as the name of a town or the new name you want to give a map document. Variables can just as easily hold numeric values such as the maximum value you're looking for for the length of a line. In object-oriented scripting languages like Python, variables can also hold objects. In ArcMap, an object might be a map document, a feature class, or a goedatabase. I'm gonna go over to Idol and demonstrate some of the points about using variables in Python. I'll just use the shell window rather than writing an actual script. Variables can have almost any name you want, it's just something you make up. As long as you follow a few simple rules and don't use any of the reserved words in Python, like print. I'll make a variable to hold a map document name. In an actual script, this might be read in from an existing file, or the script might prompt the user for the name of this file. I'll add another variable…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.