Next / Previous / Contents / Shipman's homepage

6.12. PathInfo.__str__(): Convert to a string

For the format of the string returned by this method, see Section 2, “The interface to the PathInfo object”.

We call internal methods to develop the file type, file permissions, and file modification timestamp. The assembly of the pieces, and the formatting of the size, is handled by the usual Python string format operator.
# - - -   P a t h I n f o . _ _ s t r _ _   - - -

    def __str__ ( self ):
        """Convert self to a string."""
        return ( "%s%s %s %8d %s" %
                 (self.__fileType(), self.__permFlags(),
                  self.modTime(), self.size, self.path) )