English documents:
Copy Code code as follows:
Oct (x)
Convert an integer number to a octal string. The result is a valid Python expression. If x is not a pythonobject, it has to define Anmethod this returns an integer.
Description
1. Function function converts an integer to a 8 string. If an incoming floating-point number or string is an error.
>>> A = Oct (a)
>>> a
' 0o12 '
>>> type (a) # Returns the result type is a string
<class ' str ' >
>>> Oct (10.0) # floating-point numbers cannot be converted to 8
Traceback (most recent):
File "<pyshell#3>", line 1, in <module>
Oct (10.0)
TypeError: ' Float ' object cannot is interpreted as an integer
>>> Oct (' 10 ') # string cannot be converted to 8
-Traceback (most recent C All last):
File "<pyshell#4>", line 1, in <module>
Oct (' typeerror ')
: ' str ' object cannot be interpreted as an integer
2. If the incoming argument is not an integer, it must be an instance object of a class that defines __index__ and returns an integer function.