TypeError: can only concatenate str (not “int”) to str
与 java 不同,python 的拼接字符串应写为:
msg = '我有%d'%(self.num) + '个苹果'
不能写为:
msg = '我有' + (self.num) + '个苹果'
TypeError: can only concatenate str (not “int”) to str
与 java 不同,python 的拼接字符串应写为:
msg = '我有%d'%(self.num) + '个苹果'
不能写为:
msg = '我有' + (self.num) + '个苹果'