Manual
Convert an integer number to an octal string. The result is a valid Python expression. If x is not a Python int object, it has to define an __index__() method that returns an integer.
直译
将一个整数x转化为八进制字符串,返回值为有效的Python表达式。如果x不是Python整数对象,则必须定义一个__index__()方法用来返回一个整数。
实例
>>> a = oct(10)
>>> a
'0o12'
>>> eval(a)
10