Next / Previous / Contents / Shipman's homepage

10.2. Station.__str__()

This method, which defines how to convert a Station object into a string for display, is used by the showstas and showmaws scripts to print the detail lines of their reports.

List L is built up piecewise from the various attributes. The bracketed portion containing the operator's name and work phone is added only if any of those fields are nonblank. Finally, the elements of L are concatenated and returned to the caller.
# - - -   S t a t i o n . _ _ s t r _ _   - - -

    def __str__(self):
        '''Convert self to a string.
        return("%s.%s %s %s" %
                 (self.loc.locCode, self.staCode, self.staNo,