b+=[str(a%10)] TypeError: not all arguments converted during string formatting
时间: 2023-10-28 16:27:22 浏览: 128
解决Python中报错TypeError: must be str, not bytes问题
3星 · 编辑精心推荐
This error occurs when you try to convert a non-string object into a string using the string formatting method.
In this specific case, it looks like you are trying to convert an integer (a) into a string using the formatting method, but the syntax is incorrect.
To convert an integer to a string, you can simply use the str() function without any formatting. The correct syntax would be:
b = str(a)
This will convert the integer value of a into a string and store it in the variable b.
阅读全文