Reading data from a delimited text file
File handling with Python is a very important topic for GIS programmers. Text files have been used as an interchange format to exchange data between systems. They are simple, cross-platform, and easy to process. Comma and tab-delimited text files are among the most commonly used formats for text files, so we'll take an extensive look at the Python tools available to process these files. A common task for GIS programmers is to read comma-delimited text files containing x and y coordinates, along with other attribute information. This information is then converted into GIS data formats, such as shapefiles or geodatabases.
Getting ready
To use Python's built-in file processing functionality, you must first open the file. Once open, data within the file is processed using functions provided by Python, and finally, the file is closed.
Tip
Always remember to close the file when you're done. Python does not necessarily close the files for you...