2024-06-30 16:20:50 发布
网友
我正在读Learning Python by Mark Lutz。 它写在Python表达式运算符一章中:
x ^ y - Bitwise XOR, set symmetric difference
x ^ y
在brief googling主题之后,symmetric difference我期望{}作为输出:
symmetric difference
y = ['1', '2'] x = ['2', '3'] print x ^ y
但是我得到了:
我没有得到什么?^实际上是为了什么?在
^
正如文档所说,它是set-symmetric difference,python使用set对象来演示支持所有set操作的集合。在
set
>>> y = {'1', '2'} >>> x = {'2', '3'} >>> >>> x ^ y set(['1', '3'])
正如文档所说,它是set-symmetric difference,python使用
set
对象来演示支持所有set操作的集合。在相关问题 更多 >
编程相关推荐