|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
上代码:
- class User():
- def __init__(self,name,age,high,weigh,job):
- """初始化人物信息"""
- self.name = name
- self.age = age
- self.job = job
- self.high = high
- self.weigh = weigh
- def describe_people(self):
- print(
- "Hello,my name is " + self.name.title() +","
- "I'm " + self.age + " years old,"
- "my height and weight are respectively is " + self.high + " and " + self.weigh +
- "my job is " + self.job.title())
- lvzhihang = User('lvzhihang',32,'cloud_plateform_operation',190,180)
- lvzhihang.describe_people()
复制代码
报错:"my job is " + self.job.title()) TypeError: can only concatenate str (not "int") to str
我这里接的命名是字符串啊,怎么被判定为int了
|
|