Python之namedtuple
from collections import namedtuple
Player = namedtuple('Player', ['name', 'number'])
p1 = Player('Jordan', 23)
print(p1.name) # get Jordan
黄世宇/Shiyu Huang's Personal Page:https://huangshiyu13.github.io/
from collections import namedtuple
Player = namedtuple('Player', ['name', 'number'])
p1 = Player('Jordan', 23)
print(p1.name) # get Jordan