0
时,我有一个类,它看起来像下面蟒蛇2语法错误运行的Python 3代码
class ExperimentResult(BaseDataObject):
def __init__(self, result_type: str, data: dict, references: list):
super().__init__()
self.type = result_type
self.references = references
self.data = data
def __repr__(self):
return str(self.__dict__)
当我试图运行它在Python 2 当我运行的代码是用Python编写3它我得到
def __init__(self, result_type: str, data: dict, references: list):
^
SyntaxError: invalid syntax
有没有“import_from_future”来解决这个问题?
真正溶胶ution是*停止运行** Python 2中的所有**代码* –