📜  类python代码示例中的字符串函数

📅  最后修改于: 2022-03-11 14:45:35.030000             🧑  作者: Mango

代码示例1
class Person:
    name = ""
    age = 0

    def __init__(self, personName, personAge):
        self.name = personName
        self.age = personAge

    def __repr__(self):
        return {'name':self.name, 'age':self.age}

    def __str__(self):
        return 'Person(name='+self.name+', age='+str(self.age)+ ')'