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.
Additional manipulations - ArcGIS Tutorial
From the course: Learning ArcGIS Python Scripting (2018)
Additional manipulations
- [Instructor] Let's look at a couple of special situations for working with strings in Python. First we'll look at building a SQL query that can be passed to ArcMap, and then we'll look at string slicing, which means pulling out a portion of a string. Suppose a SQL query needs to be built that needs to say flood status equals 100 year. There are some other cases where special characters need to be protected in Python. Suppose, for example, a SQL query needs to be built that is going to be passed into ArcMap. Suppose the query needs to say flood status equals 100 years. So something like this, string SQL query, that variable, is equal to flood status equals 100 year. So that's the string we need to pass into ArcMap, but this won't work because Python thinks its got two equal signs in there. I need to somehow protect the entire SQL query and I do that by putting a pair of quotes around the query. So I put some quotes on the outside and put some quotes at the beginning as well. But…
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.