From the course: Learning ArcGIS Python Scripting
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Work with strings - ArcGIS Pro Tutorial
From the course: Learning ArcGIS Python Scripting
Work with strings
- [Instructor] We have a few more basic Python rules we have to learn before we can jump into writing code for ArcGIS. This video explains how to work with strings and quotes in Python scripts. Many of the things we work with in GIS, like the name of a feature class, a city name read from an attribute table, or a directory path, they're all string values. So let's get the basics out of the way on the proper way to handle these. I've got a project open, and I'm here in a new notebook. A string is just a bit of text surrounded by either single or double quotes. So here, I have a string variable, strProjectName equal to "Kentucky.aprx," and again, I surrounded it with double quotes. There are some differences in the quote types. For everything we do in this video, you could use either single or double quotes. I'll switch them up throughout the course just so you get used to seeing both. To print a string, simply use the print statement and enclose the string in quotes. We've done this…
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.