Created
September 28, 2018 15:09
-
-
Save marcoshipe/3a1a62bbe0262ce511b5f7443322227d to your computer and use it in GitHub Desktop.
OrderedDict-ProblemaPyarTelegram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import OrderedDict | |
| custom_dict = { | |
| 'props_videos': { | |
| 1: { | |
| 'obj': 'a', | |
| 'nombre': 1 | |
| }, | |
| 2: { | |
| 'obj': 'c', | |
| 'nombre': 2 | |
| }, | |
| 3: { | |
| 'obj': 'b', | |
| 'nombre': 3 | |
| }, | |
| } | |
| } | |
| props_videos = OrderedDict() | |
| for objeto in sorted(custom_dict['props_videos'].values(), key=lambda x: x['obj']): | |
| props_videos[objeto['obj']] = objeto | |
| print(props_videos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment