Today while writing a crawler program to do division paging due to page flipping there was a
Copy Code The code is as follows.
totalCount = '100' totalPage = int(totalCount)/20
ValueError: invalid literal for int() with base 10bugs
Online the same error someone suggested to use round(float("1.0″)), but can not solve my problem, round(float("1.0″)) is used to solve the conversion of floating-point numbers to plastic numbers, the
And I have this because the original string is converted to shaping and then do the division, although for a period of time may not report an error, but after a long time will be prompted (in fact, it is a WARNING, but will force to terminate your program), the correct solution is as follows:
Copy Code The code is as follows.
Just remove the non-numeric characters from the string. Tested to work