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:
- Python TypeError: not all arguments converted during string formatting [Solved]
- Python: How to Fix “Ord() expected string of length 1, but int found”
- In Java, int is converted to string, and zero is added before the number of bits is insufficient
- make Error: error: cast from ‘int32_t*’ {aka ‘int*’} to ‘int’ loses precision [-fpermissive]
- Python error TypeError:can ‘t convert complex to float
- TypeError: Error #1034: Type Coercion failed: cannot convert mx.managers::HistoryManagerImpl@f22eee1
- Undefined reference to ‘CV:: imread (CV:: String const & int)’
- TypeError: unsupported operand type(s) for *: ‘range‘ and ‘int‘
- Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;
- Module build failed: TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- After introducing sass into Vue project, start to report error typeerror [err]_ INVALID_ ARG_ Type]: the “path” argument must be of type string
- TSLint:object access via string literals is disallowedtslint(no-string-literal)
- TypeError: ‘numpy.int64′ object is not iterable ,’int’ object is not iterable
- Type error: sequence item 0: expected STR instance, int found
- Unity short string intercepts long string
- Can’t multiply sequence by non int of type ‘float’
- The reason and solution of the error of join function: sequence item 0: expected STR instance, int found
- Pin callback Base64 decryption error
- 12-web security — error injection based on SQL Server — and, convert, cast