为什么python中的管道符号会添加到整数?

Cia*_*arz -1 python pipe

当我在python shell中执行以下操作时!

>> print 2 | 4
>> 6
Run Code Online (Sandbox Code Playgroud)

为什么python中的管道符号会添加到整数?

dan*_*451 5

它不是管道符号,它是按位OR.

2 in binary:    10
4 in binary:   100
__________________
with or:       110  (1 or 0: 1, 1 or 0: 1, 0 or 0: 0)
Run Code Online (Sandbox Code Playgroud)

二进制110是小数点后6位.