How to Solve TypeError: not all arguments converted during string formatting

Error display:

Error code display

Error analysis:

print 'URL Num:'

It prints out the string type, not the

(self.urls.has_new_url() )

The output is numeric (int type), so it needs to be transformed

That is, the code should be changed to:

Knowledge supplement:

Conversion specifier:

Transfer specifier Meaning
%d,%i Signed decimal integer
%o Unsigned octal
%u Decimal without sign
%x Unsigned hexadecimal (lowercase)
%X Unsigned hexadecimal (upper case)
%e Floating point numbers in scientific counting (lower case)
%E Floating point numbers in scientific counting
%f,%F Decimal floating point number
%g If the exponent is greater than – 4 or less than the precision value, it is the same as e, otherwise it is the same as f
%G If the exponent is greater than – 4 or less than the precision value, it is the same as e, otherwise it is the same as f
%C Single character (accepts integers or single character strings)
%r String (use repr to convert any Python object)
%s String (use STR to convert any Python object)

Similar Posts: