【问题标题】:What does the expression "~" mean [duplicate]表达“〜”是什么意思[重复]
【发布时间】:2022-01-12 18:25:15
【问题描述】:

“~”是什么意思?

【问题讨论】:

标签: python expression


【解决方案1】:

来自文档:https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations

一元~(反转)运算符产生其按位反转 整数参数。 x 的位反转定义为-(x+1)。 它仅适用于整数或覆盖的自定义对象 __invert__() 特殊方法。

【讨论】:

猜你喜欢
  • 2013-10-11
  • 1970-01-01
  • 1970-01-01
  • 2013-10-13
  • 1970-01-01
  • 2023-04-10
  • 2020-04-22
  • 1970-01-01
  • 2015-06-21
相关资源
最近更新 更多