在 DeepDiff 中比较 int 和 string (Python)

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

我使用

deepdiff
包来比较字典。

当我创建

DeepDiff({key: 0}, {key: "0"})
时,它返回一个关于类型的错误,没关系。

但是当我尝试通过参数忽略类型差异时

ignore_type_in_groups=[(str, int)]
它也会返回一个错误,但现在关于值
Value of root changed from 0 to "0".

是否可以通过某些本机设置完全忽略类型差异?

我在手册中只找到了参数

number_to_string_func
,但是当没有本地类型忽略能力时,这似乎很奇怪。

python types automated-tests
1个回答
0
投票

尝试使用

ignore_numeric_type_changes=True

© www.soinside.com 2019 - 2024. All rights reserved.