python创建对象_对Python中9种生成新对象的方法总结
先定义一个类:class Point:def __init__(self, x, y):self.x = xself.y = y下面我们使用9种方法来生成新的对象:point1 = Point(1, 2)point2 = eval("{}({}, {})".format("Point", 1, 2))point3 = globals()["Point"](1, 2)point4 = locals(...