In this video, Jennifer Harrison demonstrates some of the functions used to manipulate strings in Python. Learn how to use functions to test the length of a variable and how to split long strings into separate words.
- [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 goes inside those parentheses.…
- Writing and running Python scripts in IDLE
- Making scripts flexible with variables
- Commenting scripts
- Manipulating string data
- Object-oriented programming in Python
- Creating loops
- Reading and writing text files
- Capturing input at runtime
- Documenting your scripts
Skill Level Beginner
1. Python for ArcGIS Basics
2. Strings, Numbers, and Variables
Work with numeric values5m 22s
3. Syntax Rules
4. Manipulating Strings
5. Object-Oriented Programming
6. Using Loops
7. Generate Log Files
8. Input at Run Time
9. Help Documents
Documenting a script1m 59s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.