【问题标题】:Is it possible to change save path of a file saved by an external library?是否可以更改外部库保存的文件的保存路径?
【发布时间】:2020-08-28 17:59:07
【问题描述】:

我在 python 中使用了一个名为pyansys 的库,其中我使用了一个名为save_as_vtk 的方法。

它是:documentation

此方法为我生成一个文件并将其保存到我的工作目录。我希望将该文件保存在其他地方...我不希望它移动,因为有时它是 20+ Gb 并且需要很长时间。

有人有想法吗?

谢谢!

【问题讨论】:

    标签: python file-io output-directory


    【解决方案1】:

    我是pyansys 包的维护者。

    这是在https://github.com/akaszynski/pyansys/issues/219回答的

    在此重复:

    看来 ResultFile.save_as_vtk 已经有了一个文件名参数:

    def save_as_vtk(self, filename, rsets=None, result_types=['ENS']):
        """Writes results to a vtk readable file.
    
        The file extension will select the type of writer to use.
        ``'.vtk'`` will use the legacy writer, while ``'.vtu'`` will
        select the VTK XML writer.
    
        Parameters
        ----------
        filename : str
            Filename of grid to be written.  The file extension will
            select the type of writer to use.  ``'.vtk'`` will use the
            legacy writer, while ``'.vtu'`` will select the VTK XML
            writer.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-18
      • 1970-01-01
      • 2011-02-08
      相关资源
      最近更新 更多