Python comes with one built-in method oct() for converting an integer number to octal easily. You need to pass one integer number to this method. It will convert the integer to octal string and returns the value. One thing you should note that the returned octal string is prefixed with 0o. If the parameter value is not a python int, it should define index() method that returns an integer.