fork(3) download
  1. import json
  2.  
  3. json_str = r"""
  4. {
  5. "group 1": [{
  6. "index": 8,
  7. "API name": "RegOpenKey",
  8. "params": {
  9. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop"
  10. },
  11. "action": "Read"
  12. },
  13. {
  14. "index": 9,
  15. "API name": "RegQueryValue",
  16. "params": {
  17. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop\\SmoothScroll"
  18. },
  19. "action": "Read"
  20. },
  21. {
  22. "index": 10,
  23. "API name": "RegCloseKey",
  24. "params": {
  25. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop"
  26. },
  27. "action": "Close"
  28. },
  29. {
  30. "index": 54,
  31. "API name": "RegOpenKey",
  32. "params": {
  33. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop"
  34. },
  35. "action": "Read"
  36. },
  37. {
  38. "index": 55,
  39. "API name": "RegQueryValue",
  40. "params": {
  41. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop\\SmoothScroll"
  42. },
  43. "action": "Read"
  44. },
  45. {
  46. "index": 56,
  47. "API name": "RegCloseKey",
  48. "params": {
  49. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop"
  50. },
  51. "action": "Close"
  52. }
  53. ],
  54. "group 2": [{
  55. "index": 8,
  56. "API name": "RegOpenKey",
  57. "params": {
  58. "hKey": "HKEY_CURRENT_USER\\Control Panel\\Desktop"
  59. },
  60. "action": "Read"
  61. }]
  62. }"""
  63.  
  64. data = json.loads(json_str)
  65.  
  66. def haveKeyWord(l, keyword):
  67. _ = list(filter(lambda x: keyword in x['params']['hKey'].split("\\"), l))
  68. return True if _ else False
  69.  
  70. result = dict(filter(lambda x:haveKeyWord(x[1], "SmoothScroll"), data.items()))
  71.  
  72. print(result.keys())
Success #stdin #stdout 0.02s 30208KB
stdin
Standard input is empty
stdout
dict_keys(['group 1'])