Python ValueError: invalid literal for int() with base 10: '94352' - How to Fix
This error message indicates that the value ''94352'' cannot be converted to an integer using the int() function. The '''' character at the beginning of the string is a byte order mark (BOM) and is not recognized as a valid character by the int() function.
To fix this error, remove the BOM character from the string before converting it to an integer. You can use the strip() method to remove any leading or trailing whitespace characters, including the BOM:
value = ''94352''
value = value.strip()
integer_value = int(value)
This should convert the string '94352' to an integer without any issues.
原文地址: http://www.cveoy.top/t/topic/onhC 著作权归作者所有。请勿转载和采集!