1. Absolute value
>>> age = -18>>> age.__abs__ () 18>>> ABS (age) 18
2. Add
>>> age = -18>>> age.__add__ (+) 82>>> -18+10082
3. Quotient remainder
>>> All_item = 95>>> Pager = Ten >>> result = all_item.__divmod__ (pager) >>> print (ResU LT) (9, 5) # displays quotient and remainder in tuple format,95//10>>> age = 5>>> result = age.__rdivmod__ (2) >>> print (Result) (0 , 2) #2//5
4. Equal
Age = 18result = age.__eq__ (+) print (result)
5. Floating-point conversion
>>> age = 19>>> type (age) <type ' int ' >>>> result = age.__float__ () >>> type ( Result) <type ' float ' >
6.__floordiv__
>>> age = 5>>> result = age.__floordiv__ (6) >>> print (result) 0>>> result = age.__ FLOORDIV__ (2) >>> print (Result) 2
This article is from the "guoxianqi2016" blog, make sure to keep this source http://guoxianqi2016.blog.51cto.com/11407620/1763645
Python basic data Type-number