Python之namedtuple

from collections import namedtuple

Player = namedtuple('Player', ['name', 'number'])
p1 = Player('Jordan', 23)

print(p1.name)  # get Jordan

posted @ 2022-11-02 16:42  Shiyu_Huang  阅读(26)  评论(0编辑  收藏  举报