📅  最后修改于: 2022-03-11 14:46:09.547000             🧑  作者: Mango
from collections import namedtuple
Something = namedtuple("Something", ["x", "y"])
p1 = Point(1, 2)
print(p1)
# gá»i attribute
print(p1.x, p1.y)
# gá»i theo chá» sá»
print(p1[0], p1[1])
# nếu có ý Äá»nh gán thì error ngay láºp tức
p1.x = 2 # lá»i AttributeError: can't set attribute