Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hlpureboy
Created March 29, 2022 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hlpureboy/637f657d70f9b349c6a1ac1748173dc1 to your computer and use it in GitHub Desktop.
Save hlpureboy/637f657d70f9b349c6a1ac1748173dc1 to your computer and use it in GitHub Desktop.
import json
genre_movie = '{"genres":[{"id":28,"name":"动作"},{"id":12,"name":"冒险"},{"id":16,"name":"动画"},{"id":35,"name":"喜剧"},{"id":80,"name":"犯罪"},{"id":99,"name":"纪录"},{"id":18,"name":"剧情"},{"id":10751,"name":"家庭"},{"id":14,"name":"奇幻"},{"id":36,"name":"历史"},{"id":27,"name":"恐怖"},{"id":10402,"name":"音乐"},{"id":9648,"name":"悬疑"},{"id":10749,"name":"爱情"},{"id":878,"name":"科幻"},{"id":10770,"name":"电视电影"},{"id":53,"name":"惊悚"},{"id":10752,"name":"战争"},{"id":37,"name":"西部"}]}'
movie_dict = dict([(em['id'],em['name']) for em in json.loads(genre_movie)['genres']])
print(list(map(lambda x:movie_dict.get(x),[80, 9648, 53])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment