Skip to content

Commit 4fa13ec

Browse files
committed
Namedtuple to dictionary
1 parent 7b042ff commit 4fa13ec

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

collections.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,6 @@ Like this:
278278

279279
Animal = namedtuple('Animal', 'name age type')
280280
perry = Animal(name="perry", age=31, type="cat")
281+
print(perry._asdict())
282+
# Output: OrderedDict([('name', 'perry'), ('age', 31), ...
281283

0 commit comments

Comments
 (0)