ABSTRACT

This chapter introduces frequently used Python control structures and demonstrates methods for operating GIS objects. Control structures help computer programs break the sequence by jumping back and forth to skip a set of statements. Control structures include making decisions and loops. Decisions are one of the most basic ways to change program execution flow. A loop executes a block until its condition becomes false or until it has used up all the sequence elements in a container. Loop and decisions are used together to construct complex flow control. The chapter helps people to learn how to read data from and/or write data to a local file. When a Python program encounters an error event, it will crash if not handled. Exceptions are the errors encountered when executing Python programs. The chapter briefly covers how to capture and handle exceptions.