发生错误
TypeError: cannot concatenate 'str' and 'int' objects
修复前
print(str + int)
修复后
print(str + str(int))
原因
python 的 + 作为连接符的时候,没有自动帮你把int转换成str
TypeError: cannot concatenate 'str' and 'int' objects
print(str + int)
print(str + str(int))
python 的 + 作为连接符的时候,没有自动帮你把int转换成str