[Tutor] newbie: write ArcGIS lists to file?

zack holden zack_holden at hotmail.com
Mon Aug 4 00:16:13 CEST 2008

Dear List,
This is my first time on the list, and my first run at Python, please forgive my ignorance. 

I'm trying to use Python to access ArcGIS modules in order to perform the same task on multiple files in a folder. 

I'm able to access a set of files via: 

import arcgisscripting, string
gp = arcgisscripting.create()
gp.Workspace = "E:/data"

rasterSelect = []
rasterList = gp.ListRasters("", "tif")
raster = rasterList.Next()

  while raster:
    if raster.endswith("_dt.tif"): 
        print raster
    raster = rasterList.Next()

This produces a list of all the files I have in my folder. 

I need to begin producing .csv files of this list that I can access using other programs.

Would someone be willing to post a few lines of code showing me how to write the list the code above creates to an external file? 



More information about the Tutor mailing list