save
函数用于将HashSet保存到磁盘上的文件中。
def save(self, filename: str, binary: bool = True) -> None:
filename
: str
类型,表示要保存的文件名。binary
: bool
类型,表示文件是否为二进制文件。默认值为True。None
import open3d.core as o3d
# 创建HashSet
hash_set = o3d.core.HashSet()
# 添加元素到HashSet中
hash_set.insert(1)
hash_set.insert(2)
hash_set.insert(3)
# 保存HashSet到磁盘
hash_set.save("hash_set.bin")
IOError
: 找不到文件或无法打开文件时抛出异常。TypeError
: 如果文件名的类型不是字符串,则引发此异常。