TypeError: int() can’t convert non-string with explicit base

1. Error description

>>> int(67,8);
		  
Traceback (most recent call last):
  File "<pyshell#172>", line 1, in <module>
    int(67,8);
TypeError: int() can't convert non-string with explicit base

2. Cause of error

The int() function is used to convert a string or number type to an integer. If there is only one parameter value, the value can be string or number. However, two parameters are passed in, the first parameter is string, and the second parameter is hexadecimal (binary, octal, decimal or hexadecimal). Now in the above example, the first parameter is a number, and the second parameter is octal, so an error will be reported

3. Solutions

If you want to convert an octal number to decimal, you can do this:

>>> int('67',8);
		  
55
>>> 

Read More: