Created
July 23, 2021 13:44
-
-
Save websofter/b6b6ca518a83cdd7d90c803938ac66f0 to your computer and use it in GitHub Desktop.
Convert Python dictionary array to dictionary property array
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
| posts = [ | |
| {'name': 'Name 1', 'text': 'Some text 1'}, | |
| {'name': 'Name 2', 'text': 'Some text 2'}, | |
| {'name': 'Name 3', 'text': 'Some text 3'}, | |
| {'name': 'Name 4', 'text': 'Some text 4'} | |
| ] | |
| posts_text = [] | |
| posts_text = list(map(lambda p: p['text'], posts)) | |
| print(list(posts_text)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment