From the course: Learning ArcGIS Python Scripting
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Write a script that reads from and writes to a file - ArcGIS Pro Tutorial
From the course: Learning ArcGIS Python Scripting
Write a script that reads from and writes to a file
- [Instructor] Let's see how manipulating data in a text file looks in a script. I'm going to write a script that reads in information about the location of some chemical storage tanks. It's going to select only the crude oil tanks and write those out to a separate file. In addition to showing you how the read line and the write methods work, this script will also remind you about how to use conditional statements and loops. Let me show you what the little text file looks like that I'm going to work with. It's the same comma separated data file we saw earlier. It's got an object ID column, which is basically a record number, the status of the tank, whether it's active or decommissioned, what the tank holds, crude oil, diesel, benzene, or other chemicals, and it's got a latitude and a longitude coordinate for each tank. I'm going to write a script to find only the crude oil tank records and put them in a new file. I've provided this CSV file for you in the exercise files for the…
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)
Read from and write to a text file5m 47s
-
(Locked)
Write a script that reads from and writes to a file9m 16s
-
(Locked)
Write a script that records broken links8m 28s
-
(Locked)
Challenge: Describe feature classes and write to a file1m 33s
-
(Locked)
Solution: Describe feature classes and write to a file5m 6s
-
(Locked)
-
-
-