from collections import namedtuple
points=namedtuple("points","x y z")
color=namedtuple("color","red blue green")
pixel=namedtuple("pixel",points._fields+color._fields)
pixel(11,12,13,14,15,16)
print(pixel.x)
答案 0 :(得分:1)
将pixel(11,12,13,14,15,16)
分配给变量并再次尝试:
variable = pixel(11,12,13,14,15,16)
print(variable.x)