daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f = open('file-20171020T1500.json', 'r')
  2. import json
  3. import operator
  4.  
  5. dc = {}
  6. dc_n = {}
  7.  
  8. for l in f:
  9.     j = json.loads(l)
  10.     scans = j["scans"]
  11.     for i in scans:
  12.         if scans[i]["detected"] == True:
  13.             if i in dc.keys():
  14.                 dc[i] += 1
  15.             else:
  16.                 dc[i] = 1
  17.         elif scans[i]["detected"] == False:
  18.             if i in dc_n.keys():
  19.                 dc_n[i] += 1
  20.             else:
  21.                 dc_n[i] = 1
  22.        
  23. d2 = {}
  24. for i in dc.keys():
  25.     d2[i] = dc[i] / (dc[i]+dc_n[i])
  26.  
  27. d2 = sorted(d2.items(), key=operator.itemgetter(1))
  28.  
  29. for k, v in d2:
  30.     print(k, v)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top