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 - ArcGIS Pro Tutorial
From the course: Learning ArcGIS Python Scripting
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…
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.
Contents
-
-
-
-
-
-
(Locked)
Working with lists6m 18s
-
(Locked)
List methods and functions8m 48s
-
(Locked)
Use loops to work with lists7m 50s
-
(Locked)
Write a script using list methods and a for-loop3m 39s
-
(Locked)
Nested loops8m 16s
-
(Locked)
Conditional statements7m 35s
-
(Locked)
Write a script using ArcGIS API10m 31s
-
(Locked)
Getting to the properties of GIS data with Describe3m 28s
-
(Locked)
Challenge: Properties of layers37s
-
(Locked)
Solution: Properties of layers3m 4s
-
(Locked)
-
-
-
-