[学习笔记] Python 报错 can only concatenate str (not "int") to str

错误内容:
can only concatenate str (not "int") to str 
错误代码:
print("jianxieshi"+ c+ ".")

错误原因:

print 命令后引号内应该都是字符串 而不是变量

更正  

print("jianxieshi"+ str(c)+ ".")

猜你喜欢

转载自www.cnblogs.com/programmingnoob/p/11184548.html
今日推荐