From the course: Learning ArcGIS Python Scripting

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Working with lists

Working with lists

- [Instructor] Let's talk about variables again because we need to learn about holding a whole list of values in a variable. Variables that hold a single value, like a string, a number, or an object, those are called scalar variables. We've used those often in this course. So I've created a variable called strLayerName, and I've set it equal to the string Kentucky Rivers. And I can print that out. We've done that many times. But there are many cases where a variable will hold a list of values, for example, a list of all the layer names in a map. So I'm going to create a variable called strLayers, and I'm going to set it equal to a list. So I've created the variable strLayers, I've set it equal to a list of pretend layer names, ["Kentucky Rivers","State Roads","Bridges","Horse Farms"]. I can print out that variable, and we'll see we get the entire list. Python's okay with this. A list is simply a collection of elements of any kind. So a list of strings, but also, it could be a list of…

Contents