在Python中//=赋值运算符做什么

2024-06-28 19:32:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我在读http://hyperpolyglot.org/scripting时遇到了//=assignemnt运算符。我以前从没见过。它有什么作用?在


Tags: orghttp运算符scriptingassignemnthyperpolyglot
3条回答

如果x /= yx = x / y,那么我假设x //= y是{}。在

//是整数除法

为了规范

x = 16
x //= 2

x的值是8。基本上,x = x // 2,整数除法

它确实在integer division的地方。在

不管值多少钱,它在operator模块中也可用,即^{}。在

相关问题 更多 >