fork download
  1. dic = {"foreignNames":[
  2. {
  3. "name":"Archange Avacyn",
  4. "language":"French",
  5. "multiverseid":411061
  6. },
  7. {
  8. "name":"Erzengel Avacyn",
  9. "language":"German",
  10. "multiverseid":410731
  11. },
  12. {
  13. "name":"Arcangelo Avacyn",
  14. "language":"Italian",
  15. "multiverseid":411391
  16. },
  17. {
  18. "name":"大天使アヴァシン",
  19. "language":"Japanese",
  20. "multiverseid":411721
  21. },
  22. {
  23. "name":"대천사 아바신",
  24. "language":"Korean",
  25. "multiverseid":412051
  26. },
  27. {
  28. "name":"Arcanjo Avacyn",
  29. "language":"Portuguese (Brazil)",
  30. "multiverseid":412381
  31. }
  32. ]}
  33.  
  34. def find_lang(lingua):
  35. for i in dic['foreignNames']:
  36. if(i['language'].lower().startswith(lingua.lower())):
  37. return i
  38. return None
  39.  
  40. lang = find_lang('portuguese')
  41. print(lang)
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
{'language': 'Portuguese (Brazil)', 'name': 'Arcanjo Avacyn', 'multiverseid': 412381}