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

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…

Contents