INNER CODE UNIT · Python

to_soft

guma44/GEOparse · src/GEOparse/GEOTypes.py:161

    def to_soft(self, path_or_handle, as_gzip=False):
        """Save the object in a SOFT format.

        Args:
            path_or_handle (:obj:`str` or :obj:`file`): Path or handle to
                output file
            as_gzip (:obj:`bool`): Save as gzip
        """
        if isinstance(path_or_handle, str):
            if as_gzip:
                with gzip.open(path_or_handle, "wt") as outfile:
                    outfile.write(self._get_object_as_soft())
            else:
                with open(path_or_handle, "w") as outfile:
                    outfile.write(self._get_object_as_soft())
        else:
            path_or_handle.write(self._get_object_as_soft())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…