Python Inside int function introduction

Source: Internet
Author: User

Bit_length () #用二进制数表示10进制数时, the minimum number of bits (length) in binary

columns such as:2 in binary notation as0000001010 using bit_ength () means that the length is 1 bits, it will automatically omit the previous 0 Bin (2) in binary notation 2columns such asBin (2)0b10 0b means binary __abs__ take absolute valuecolumns such as: Take the absolute value of threea=-3a.__abs__ ()3An underlined representation of built-in functions in Pythonthe use of built-in functions can be invoked through objects or directlycolumns such as:object, go directly to execute this methoda.__abs__ ()call directly, it will first go to the memory to create this object, and then go to execute this methodABS ( -3) __add__ Increasecolumns such asa=9a.__add__ (1)10 at this time a=10, increased by 1, the direct call is the + number, such as the Plus, the response to the code is add __divmod__ is often used for paging, and once it converts the quotient and remainder of the two divided numbers into a tuple, the remainder can be judged directly.columns such as:a=95b=10cc=a.__divmod__ (b)Print cc(9,5) __eq__ Determines whether two numbers are equal, returns true for equality, does not return false in 2, is the other, and 3 is itcolumns such as:
Aa=18
Bb=19
cc=aa.__eq__ (BB)
Print (CC)

 __float__ Conversion of floating-point typescolumns such as: CC conversion for floating-point type 

__floordiv__, except for the result of the integer part of the pickup and/or similarcolumns such as: __ge__ judgment greater than equals, equivalent to >=, correct return true, error return falsecolumns such as: 

There are a lot of similar things that can be viewed with help to see, many of which can be represented by operator +-*/There is rdivmod many similar, in fact, the function is the same as the front, but it changed from right to left operation, run from left to right to usecolumns such as 

    

Python Inside int function introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.