I get a Traceback Type Error Employee() takes no arguments, when trying to create a class method to parse string and create object in python

前端 未结 0 592
悲&欢浪女
悲&欢浪女 2020-12-02 07:37

class Employee(object): @classmethod def from_string(cls, emp_str): first_name, last_name, pay = emp_str.split(\'-\') return cls(first_name, last_name, pay)

相关标签:
回答
  • 消灭零回复
提交回复
热议问题