python语言int什么意思_请问python中int的意思是什么?

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> help(int)

Help on class int in module builtins:

class int(object)

| int(x=0) -> integer

| int(x, base=10) -> integer

|

| Convert a number or string to an integer, or return 0 if no arguments

| are given. If x is a number, return x.__int__(). For floating point

| numbers, this truncates towards zero.

|

| If x is not a number or if base is given, then x must be a string,

| bytes, or bytearray instance representing an integer literal in the

| given base. The literal can be preceded by '+' or '-' and be surrounded

| by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.

| Base 0 means to interpret the base from the string as an integer literal.

| >>> int('0b100', base=0)

| 4

|

| Methods defined here:

|

| __abs__(self, /)

| abs(self)

|

| __add__(self, value, /)

| Return self+value.

|

| __and__(self, value, /)

| Return self&value.

|

| __bool__(self, /)

| self != 0

|

| __ceil__(...)

| Ceiling of an Integral returns itself.

|

| __divmod__(self, value, /)

| Return divmod(self, value).

|

| __eq__(self, value, /)

| Return self==value.

|

| __float__(self, /)

| float(self)

|

| __floor__(...)

| Flooring an Integral returns itself.

|

| __floordiv__(self, value, /)

| Return self//value.

|

| __format__(...)

| default object formatter

|

| __ge__(self, value, /)

| Return self>=value.

|

| __getattribute__(self, name, /)

| Return getattr(self, name).

|

| __getnewargs__(...)

|

| __gt__(self, value, /)

| Return self>value.

|

| __hash__(self, /)

| Return hash(self).

|

| __index__(self, /)

| Return self converted to an integer, if self is suitable for use as an index into a list.

|

| __int__(self, /)

| int(self)

|

| __invert__(self, /)

| ~self

|

| __le__(self, value, /)

| Return self<=value.

|

| __lshift__(self, value, /)

| Return self<

|

| __lt__(self, value, /)

| Return self

|

| __mod__(self, value, /)

| Return self%value.

|

| __mul__(self, value, /)

| Return self*value.

|

| __ne__(self, value, /)

| Return self!=value.

|

| __neg__(self, /)

| -self

|

| __new__(*args, **kwargs) from builtins.type

| Create and return a new object. See help(type) for accurate signature.

|

| __or__(self, value, /)

| Return self|value.

|

| __pos__(self, /)

| +self

|

| __pow__(self, value, mod=None, /)

| Return pow(self, value, mod).

|

| __radd__(self, value, /)

| Return value+self.

|

| __rand__(self, value, /)

| Return value&self.

|

| __rdivmod__(self, value, /)

| Return divmod(value, self).

|

| __repr__(self, /)

| Return repr(self).

|

| __rfloordiv__(self, value, /)

| Return value//self.

|

| __rlshift__(self, value, /)

| Return value<

|

| __rmod__(self, value, /)

| Return value%self.

|

| __rmul__(self, value, /)

| Return value*self.

|

| __ror__(self, value, /)

| Return value|self.

|

| __round__(...)

| Rounding an Integral returns itself.

| Rounding with an ndigits argument also returns an integer.

|

| __rpow__(self, value, mod=None, /)

| Return pow(value, self, mod).

|

| __rrshift__(self, value, /)

| Return value>>self.

|

| __rshift__(self, value, /)

| Return self>>value.

|

| __rsub__(self, value, /)

| Return value-self.

|

| __rtruediv__(self, value, /)

| Return value/self.

|

| __rxor__(self, value, /)

| Return value^self.

|

| __sizeof__(...)

| Returns size in memory, in bytes

|

| __str__(self, /)

| Return str(self).

|

| __sub__(self, value, /)

| Return self-value.

|

| __truediv__(self, value, /)

| Return self/value.

|

| __trunc__(...)

| Truncating an Integral returns itself.

|

| __xor__(self, value, /)

| Return self^value.

|

| bit_length(...)

| int.bit_length() -> int

|

| Number of bits necessary to represent self in binary.

| >>> bin(37)

| '0b100101'

| >>> (37).bit_length()

| 6

|

| conjugate(...)

| Returns self, the complex conjugate of any int.

|

| from_bytes(...) from builtins.type

| int.from_bytes(bytes, byteorder, *, signed=False) -> int

|

| Return the integer represented by the given array of bytes.

|

| The bytes argument must be a bytes-like object (e.g. bytes or bytearray).

|

| The byteorder argument determines the byte order used to represent the

| integer. If byteorder is 'big', the most significant byte is at the

| beginning of the byte array. If byteorder is 'little', the most

| significant byte is at the end of the byte array. To request the native

| byte order of the host system, use `sys.byteorder' as the byte order value.

|

| The signed keyword-only argument indicates whether two's complement is

| used to represent the integer.

|

| to_bytes(...)

| int.to_bytes(length, byteorder, *, signed=False) -> bytes

|

| Return an array of bytes representing an integer.

|

| The integer is represented using length bytes. An OverflowError is

| raised if the integer is not representable with the given number of

| bytes.

|

| The byteorder argument determines the byte order used to represent the

| integer. If byteorder is 'big', the most significant byte is at the

| beginning of the byte array. If byteorder is 'little', the most

| significant byte is at the end of the byte array. To request the native

| byte order of the host system, use `sys.byteorder' as the byte order value.

|

| The signed keyword-only argument determines whether two's complement is

| used to represent the integer. If signed is False and a negative integer

| is given, an OverflowError is raised.

|

| ----------------------------------------------------------------------

| Data descriptors defined here:

|

| denominator

| the denominator of a rational number in lowest terms

|

| imag

| the imaginary part of a complex number

|

| numerator

| the numerator of a rational number in lowest terms

|

| real

| the real part of a complex number

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值