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.

String functions

String functions - ArcGIS Tutorial

From the course: Learning ArcGIS Python Scripting (2018)

Start my 1-month free trial

String functions

- [Instructor] There are over 40 Python String Functions that are used in the Field Calculator in ArcGIS. And also in Label Expressions. These same functions plus many others can be used in a Python Script. For example, the Replace Function replaces a portion of a string with a different bit of text. You could use it here in the Field Calculator, but you can also use it in your Python Script. I have a Python IDLE Shell window open where I can demonstrate some of these functions. Suppose we create a variable called, strRockType and we set it equal to Sandstone. I could use the Replace Function, to change the word just a little bit. If I print the variable plus tag on to it, the Replace Function and I put a set of parentheses and I put the word that I want to search for followed by the word I want to replace it with. So now it prints limestone. If there's any information needed to tell a function how to work, that information is passed in as function parameters. That's the part that…

Contents