Home > Back-end >  Python dictionary form transformation
Python dictionary form transformation

Time:11-04

1. The dictionary conversion
D1={' A ', 1, 'B.A: 2,' B.B: 3, 'CC. D.E: 4,' CC. D.F: 5}

Define a function to d1 into the following format:

{' A ': 1,
'B' : {' A ': 2,
'B' : 3},
'CC' : {' D ': {
'E' : 4,
'F' : 5
}}
}
  • Related