Skip to content

Instantly share code, notes, and snippets.

View DGideas's full-sized avatar

Wanlin Wang DGideas

  • Beijing Institute of Petrochemical Technology
  • Singapore
  • 23:31 (UTC +08:00)
  • X @DGClouds
View GitHub Profile
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)