Named tuples (collections.namedtuple) in Python

Point = collections.namedtuple('Point', ['x', 'y']) p = Point(x=1.0, y=2.0) print(p) print(p.x) print(p.y)
Named tuples (collections.namedtuple).

#python #code #cesarnog

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.