Python中的管道字符 [英] Pipe character in Python

查看:457
本文介绍了Python中的管道字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到函数调用中使用了竖线"字符(|):

I see a "pipe" character (|) used in a function call:

res = c1.create(go, come, swim, "", startTime, endTime, "OK", ax|bx)

ax|bx中管道的含义是什么?

What is the meaning of the pipe in ax|bx?

推荐答案

它是整数的按位或.例如,如果axbx之一或全部为1,则其值为1,否则为0.它还适用于其他整数,例如15 | 128 = 143,即二进制形式的00001111 | 10000000 = 10001111.

It is a bitwise OR of integers. For example, if one or both of ax or bx are 1, this evaluates to 1, otherwise to 0. It also works on other integers, for example 15 | 128 = 143, i.e. 00001111 | 10000000 = 10001111 in binary.

这篇关于Python中的管道字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆