Created
March 8, 2021 16:15
-
-
Save DGideas/c6ba07e7be68b00c24ac5751be37da16 to your computer and use it in GitHub Desktop.
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
| a = [ | |
| {"userid":"Change","tags":[{"type":1,"tag_id":"e" }],}, | |
| {"userid":"andy.lei","tags":[{"type":1,"tag_id":"eg" },{"type":1,"tag_id":"ti"}],} | |
| ] | |
| result = [] | |
| [*map(lambda x: result.extend([{"userid": x["userid"], "tagid": tag["tag_id"]} for tag in x["tags"]]), a)] | |
| print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment