**数学运算符在Python中做什么? [英] What does the ** maths operator do in Python?

查看:99
本文介绍了**数学运算符在Python中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在Python中是什么意思:

What does this mean in Python:

sock.recvfrom(2**16)

我知道袜子是什么,我了解了recvfrom函数的要旨,但是2**16到底是什么?具体来说,两个星号/双星号运算符?

I know what sock is, and I get the gist of the recvfrom function, but what the heck is 2**16? Specifically, the two asterisk/double asterisk operator?

(英文关键字,因为很难搜索:倍数星号星号-星号双倍数双星号双星运算符)

推荐答案

这是电力运营商.

从Python 3文档中:

From the Python 3 docs:

幂运算符的语义与内置的 pow()函数,当使用两个参数调用时:将其左参数提升为右参数的幂.首先将数字参数转换为通用类型,然后结果就是该类型.

The power operator has the same semantics as the built-in pow() function, when called with two arguments: it yields its left argument raised to the power of its right argument. The numeric arguments are first converted to a common type, and the result is of that type.

相当于2 16 = 65536,或pow(2, 16)

It is equivalent to 216 = 65536, or pow(2, 16)

这篇关于**数学运算符在Python中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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