字符串组之间差异的排序
当我遇到一个问题时,我正在处理一条自定义错误消息: pytest.railise(错误,match = f'Error_message_part1 {set1 -set2} error_message_part2')
基本上,我不了解set1和set2之间的结果的排序如何起作用。即使我经过的文档也是如此,似乎也有订单。我正在与Python 3.9.10合作,
我有兴趣了解结果的“分类”如何工作。
Here is the simple example that highlighted the issue:
>>> a = {'a', 'b', 'c', 'd', 'e'}
>>> b = {'b', 'd'}
>>> a - b
{'e', 'a', 'c'}
>>> a = {'c', 'b', 'a', 'd', 'e'}
>>> a - b
{'e', 'a', 'c'}
>>> a = {'e', 'b', 'a', 'd', 'c'}
>>> a - b
{'e', 'a', 'c'}
I was working on a customised error message when I came across an issue using:pytest.raises(error, match=f'error_message_part1 {set1 - set2} error_message_part2')
Basically, I don't understand how the ordering of the result between set1 and set2 works. There seems to be an ordering even though the documentation as far as I went through it says otherwise. I am working with python 3.9.10
I am interested in understanding how the 'sorting' of the result works.
Here is the simple example that highlighted the issue:
>>> a = {'a', 'b', 'c', 'd', 'e'}
>>> b = {'b', 'd'}
>>> a - b
{'e', 'a', 'c'}
>>> a = {'c', 'b', 'a', 'd', 'e'}
>>> a - b
{'e', 'a', 'c'}
>>> a = {'e', 'b', 'a', 'd', 'c'}
>>> a - b
{'e', 'a', 'c'}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论