python學習(五)常用數據類型之int

類名:int

  1     def bit_length(self):  # real signature unknown; restored from __doc__
  2         """ 返回用二進制表示該數字需要的最少位數 """
  3         """
  4         int.bit_length() -> int
  5 
  6         Number of bits necessary to represent self in binary.
  7         >>> bin(37)
  8         '0b100101'
  9         >>> (37).bit_length()
 10         6
 11         """
 12         return 0
 13 
 14     def conjugate(self, *args, **kwargs):  # real signature unknown
 15         """ 返回該數字的共軛複數 """
 16         """ Returns self, the complex conjugate of any int. """
 17         pass
 18 
 19     @classmethod  # known case
 20     def from_bytes(cls, bytes, byteorder, *args,**kwargs):  # real signature unknown; NOTE: unreliably restored from __doc__
 21         """ 將字節轉換成相應的數字,其中byte是字節;byteorder是字節順序,big是高字節在後低字節在前
 22             little是低字節在後,高字節在前;signed表示的是有符號和無符號
 23         """
 24         """
 25         int.from_bytes(bytes, byteorder, *, signed=False) -> int
 26 
 27         Return the integer represented by the given array of bytes.
 28 
 29         The bytes argument must be a bytes-like object (e.g. bytes or bytearray).
 30 
 31         The byteorder argument determines the byte order used to represent the
 32         integer.  If byteorder is 'big', the most significant byte is at the
 33         beginning of the byte array.  If byteorder is 'little', the most
 34         significant byte is at the end of the byte array.  To request the native
 35         byte order of the host system, use `sys.byteorder' as the byte order value.
 36 
 37         The signed keyword-only argument indicates whether two's complement is
 38         used to represent the integer.
 39         """
 40         pass
 41 
 42     def to_bytes(self, length, byteorder, *args,**kwargs):  # real signature unknown; NOTE: unreliably restored from __doc__
 43         """ 把數字轉換成字節類型的格式,from_bytes的過程 """
 44         """
 45         int.to_bytes(length, byteorder, *, signed=False) -> bytes
 46 
 47         Return an array of bytes representing an integer.
 48 
 49         The integer is represented using length bytes.  An OverflowError is
 50         raised if the integer is not representable with the given number of
 51         bytes.
 52 
 53         The byteorder argument determines the byte order used to represent the
 54         integer.  If byteorder is 'big', the most significant byte is at the
 55         beginning of the byte array.  If byteorder is 'little', the most
 56         significant byte is at the end of the byte array.  To request the native
 57         byte order of the host system, use `sys.byteorder' as the byte order value.
 58 
 59         The signed keyword-only argument determines whether two's complement is
 60         used to represent the integer.  If signed is False and a negative integer
 61         is given, an OverflowError is raised.
 62         """
 63         pass
 64 
 65     def __abs__(self, *args, **kwargs):  # real signature unknown
 66         """ 取絕對值 """
 67         """ abs(self) """
 68         pass
 69 
 70     def __add__(self, *args, **kwargs):  # real signature unknown
 71         """ 求和運算 """
 72         """ Return self+value. """
 73         pass
 74 
 75     def __and__(self, *args, **kwargs):  # real signature unknown
 76         """ 按位與運算 """
 77         """ Return self&value. """
 78         pass
 79 
 80     def __bool__(self, *args, **kwargs):  # real signature unknown
 81         """ 返回布爾值,非0數的布爾值是True,0的布爾值是False """
 82         """  """
 83         """ self != 0 """
 84         pass
 85 
 86     def __ceil__(self, *args, **kwargs):  # real signature unknown
 87         """ 返回這個整數本身 """
 88         """ Ceiling of an Integral returns itself. """
 89         pass
 90 
 91     def __divmod__(self, *args, **kwargs):  # real signature unknown
 92         """ (num1).__divmod__(num2) 將num1除以num2,返回的是一個格式爲(商,餘數)的元組 """
 93         """ Return divmod(self, value). """
 94         pass
 95 
 96     def __eq__(self, *args, **kwargs):  # real signature unknown
 97         """ (num1).__eq__(num2)  比較num1和num2的值,相等返回True,不等返回False """
 98         """ Return self==value. """
 99         pass
100 
101     def __float__(self, *args, **kwargs):  # real signature unknown
102         """ 將數字從整數類型轉換成浮點類型 """
103         """ float(self) """
104         pass
105 
106     def __floordiv__(self, *args, **kwargs):  # real signature unknown
107         """ 地板除,相當於 // 運算 """
108         """ Return self//value. """
109         pass
110 
111     def __floor__(self, *args, **kwargs):  # real signature unknown
112         """ 返回這個數本身 """
113         """ Flooring an Integral returns itself. """
114         pass
115 
116     def __format__(self, *args, **kwargs):  # real signature unknown
117         pass
118 
119     def __getattribute__(self, *args, **kwargs):  # real signature unknown
120         """ x.__getattribute__('name') == x.name """
121         """ Return getattr(self, name). """
122         pass
123 
124     def __getnewargs__(self, *args, **kwargs):  # real signature unknown
125         """ 內部調用 __new__方法或創建對象時傳入參數使用 """
126         pass
127 
128     def __ge__(self, *args, **kwargs):  # real signature unknown
129         """ (num1).__ge__(num2) 如果num1大於或等於num2,則返回True,否則返回False """
130         """ Return self>=value. """
131         pass
132 
133     def __gt__(self, *args, **kwargs):  # real signature unknown
134         """ (num1).__ge__(num2) 如果num1大於num2,則返回True,否則返回False """
135         """ Return self>value. """
136         pass
137 
138     def __hash__(self, *args, **kwargs):  # real signature unknown
139         """ 如果對象object爲哈希表類型,返回對象object的哈希值。哈希值爲整數。
140         在字典查找中,哈希值用於快速比較字典的鍵。兩個數值如果相等,則哈希值也相等 """
141         """ Return hash(self). """
142         pass
143 
144     def __index__(self, *args, **kwargs):  # real signature unknown
145         """ 用於切片,數字無意義
146             x[y:z] <==> x[y.__index__():z.__index__()]
147         """
148         """ Return self converted to an integer, if self is suitable for use as an index into a list. """
149         pass
150 
151     def __init__(self, x, base=10):  # known special case of int.__init__
152         """ 構造方法,創建int對象時自動調用 """
153         """
154         int(x=0) -> integer
155         int(x, base=10) -> integer
156 
157         Convert a number or string to an integer, or return 0 if no arguments
158         are given.  If x is a number, return x.__int__().  For floating point
159         numbers, this truncates towards zero.
160 
161         If x is not a number or if base is given, then x must be a string,
162         bytes, or bytearray instance representing an integer literal in the
163         given base.  The literal can be preceded by '+' or '-' and be surrounded
164         by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
165         Base 0 means to interpret the base from the string as an integer literal.
166         >>> int('0b100', base=0)
167         4
168         # (copied from class doc)
169         """
170         pass
171 
172     def __int__(self, *args, **kwargs):  # real signature unknown
173         """ 轉換成整數類型 """
174         """ int(self) """
175         pass
176 
177     def __invert__(self, *args, **kwargs):  # real signature unknown
178         """ 按位取反, (x).__invert__()類似於-x-1  """
179         """ ~self """
180         pass
181 
182     def __le__(self, *args, **kwargs):  # real signature unknown
183         """ (num1).__ge__(num2) 如果num1小於或等於num2,則返回True,否則返回False """
184         """ Return self<=value. """
185         pass
186 
187     def __lshift__(self, *args, **kwargs):  # real signature unknown
188         """ """
189         """ Return self<<value. """
190         pass
191 
192     def __lt__(self, *args, **kwargs):  # real signature unknown
193         """ (num1).__ge__(num2) 如果num1小於num2,則返回True,否則返回False """
194         """ Return self<value. """
195         pass
196 
197     def __mod__(self, *args, **kwargs):  # real signature unknown
198         """ 取模運算 """
199         """ Return self%value. """
200         pass
201 
202     def __mul__(self, *args, **kwargs):  # real signature unknown
203         """ 乘法運算 """
204         """ Return self*value. """
205         pass
206 
207     def __neg__(self, *args, **kwargs):  # real signature unknown
208         """ (x).__neg() <==> -(x) """
209         """ -self """
210         pass
211 
212     @staticmethod  # known case of __new__
213     def __new__(*args, **kwargs):  # real signature unknown
214         """ Create and return a new object.  See help(type) for accurate signature. """
215         pass
216 
217     def __ne__(self, *args, **kwargs):  # real signature unknown
218         """ x.__ne__(y) 如果x與y的值不相等,返回True,相等則返回False """
219         """ Return self!=value. """
220         """  """
221         pass
222 
223     def __or__(self, *args, **kwargs):  # real signature unknown
224         """ 按位或運算 """
225         """ Return self|value. """
226         pass
227 
228     def __pos__(self, *args, **kwargs):  # real signature unknown
229         """ (x).__pos__()  <==> +(x) """
230         """ +self """
231         pass
232 
233     def __pow__(self, *args, **kwargs):  # real signature unknown
234         """ (x).__pow__(y)  <==> x**y """
235         """ Return pow(self, value, mod). """
236         pass
237 
238     def __radd__(self, *args, **kwargs):  # real signature unknown
239         """ 後面的數加上前面的數 """
240         """ Return value+self. """
241         pass
242 
243     def __rand__(self, *args, **kwargs):  # real signature unknown
244         """ 後面的數對前面的數進行按位與運算 """
245         """ Return value&self. """
246         pass
247 
248     def __rdivmod__(self, *args, **kwargs):  # real signature unknown
249         """ (num1).__divmod__(num2) 將num2除以num1,返回的是一個格式爲(商,餘數)的元組 """
250         """ Return divmod(value, self). """
251         pass
252 
253     def __repr__(self, *args, **kwargs):  # real signature unknown
254         """ 轉化爲解釋器可讀取的形式 """
255         """ Return repr(self). """
256         pass
257 
258     def __rfloordiv__(self, *args, **kwargs):  # real signature unknown
259         """ 後面的數對前面的數進行取整除運算 """
260         """ Return value//self. """
261         pass
262 
263     def __rlshift__(self, *args, **kwargs):  # real signature unknown
264         """ 左移 (x).__lshift__(y) 相當與y*2^x """
265         """ Return value<<self. """
266         pass
267 
268     def __rmod__(self, *args, **kwargs):  # real signature unknown
269         """ 後面的數與前面的數進行取模運算 """
270         """ Return value%self. """
271         pass
272 
273     def __rmul__(self, *args, **kwargs):  # real signature unknown
274         """ 後面的數乘以前面的數 """
275         """ Return value*self. """
276         pass
277 
278     def __ror__(self, *args, **kwargs):  # real signature unknown
279         """ 後面的數和前面的數進行按位或運算 """
280         """ Return value|self. """
281         pass
282 
283     def __round__(self, *args, **kwargs):  # real signature unknown
284         """ 返回小數點四捨五入到N個數字,整型無意義 """
285         """
286         Rounding an Integral returns itself.
287         Rounding with an ndigits argument also returns an integer.
288         """
289         pass
290 
291     def __rpow__(self, *args, **kwargs):  # real signature unknown
292         """ (x).__rpow__(y) <==> y**x """
293         """ Return pow(value, self, mod). """
294         pass
295 
296     def __rrshift__(self, *args, **kwargs):  # real signature unknown
297         """ 右移 (x).__rrshift__(y) 相當於y//(2^x) """
298         """ Return value>>self. """
299         pass
300 
301     def __rshift__(self, *args, **kwargs):  # real signature unknown
302         """ 右移 (x).__rshift__(y) 相當於x//(2^y) """
303         """ Return self>>value. """
304         pass
305 
306     def __rsub__(self, *args, **kwargs):  # real signature unknown
307         """ 後面的數減去前面的數 """
308         """ Return value-self. """
309         pass
310 
311     def __rtruediv__(self, *args, **kwargs):  # real signature unknown
312         """ 將後面的數除以前面的數 """
313         """ Return value/self. """
314         pass
315 
316     def __rxor__(self, *args, **kwargs):  # real signature unknown
317         """ 將後面的數與前面的數按位異或 """
318         """ Return value^self. """
319         pass
320 
321     def __sizeof__(self, *args, **kwargs):  # real signature unknown
322         """ 返回佔用的字節數 """
323         """ Returns size in memory, in bytes """
324         pass
325 
326     def __str__(self, *args, **kwargs):  # real signature unknown
327         """ 轉換成可讀取的形式 """
328         """ Return str(self). """
329         pass
330 
331     def __sub__(self, *args, **kwargs):  # real signature unknown
332         """ 將前面的數減去後面的數 """
333         """ Return self-value. """
334         pass
335 
336     def __truediv__(self, *args, **kwargs):  # real signature unknown
337         """ 將前面的數除以後面的數 """
338         """ Return self/value. """
339         pass
340 
341     def __trunc__(self, *args, **kwargs):  # real signature unknown
342         """ 返回數值被截取爲整型的值,在整型中無意義 """
343         """ Truncating an Integral returns itself. """
344         pass
345 
346     def __xor__(self, *args, **kwargs):  # real signature unknown
347         """ 將前面的數與後面的數按位異或 """
348         """ Return self^value. """
349         pass

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章