[Solved] How to create a tuple of the given structure in python [closed]


It is essentially a named tuple inside another tuple. A named tuple is an easy way to create a class. You can create that structure as follows.

>>> from collections import namedtuple
>>> Status = namedtuple('Status', 'message code')
>>> s = Status('Success', 0)
>>> s
Status(message="Success", code=0)
>>> (s, [[]])
(Status(message="Success", code=0), [[]])

Documentation for namedtuple is here.

1

solved How to create a tuple of the given structure in python [closed]