是否可以更改由外部库保存的文件的保存路径?

问题描述 投票:1回答:1

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

有:documentation

此方法为我生成一个文件,并将其保存到我的工作目录中。我希望将该文件保存在其他位置...我不希望它移动,因为有时它是20 Gb以上,并且会花费太长时间。

有人有想法吗?

谢谢!

python file-io output-directory
1个回答
0
投票

我是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.
© www.soinside.com 2019 - 2024. All rights reserved.