from collections import namedtuple Point = namedtuple("Point", ['x', 'y']) p = Point(3, 5) print(p.x, p.y) #using attributes print(p[0], p[1]) # using indexes
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter