PyDocs

Nav

Data Types

somenamedtuple._asdict

  • somenamedtuple._asdict()
Return a new dict which maps field names to their corresponding values:
Changed in 3.1, 3.8
  • 3.1: Returns an OrderedDict instead of a regular dict.
  • 3.8: Returns a regular dict instead of an OrderedDict. As of Python 3.7, regular dicts are guaranteed to be ordered. If the extra features of OrderedDict are required, the suggested remediation is to cast the result to the desired type: OrderedDict(nt._asdict()).
1 Example
>>> p = Point(x=11, y=22)
>>> p._asdict()
{'x': 11, 'y': 22}
from the Python docs
See Also
No see-alsos for collections/somenamedtuple._asdict
0 Notes
No notes for somenamedtuple._asdict