-
Notifications
You must be signed in to change notification settings - Fork 0
/
Criteria.py
36 lines (31 loc) · 927 Bytes
/
Criteria.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import shlex
from compiler.ast import Print
allselectors={}
total=0
#with open('CSSDBCriteria.txt','r') as f:
with open('CSSDBCriteria.txt','r') as f:
newlines = []
for line in f.readlines():
line=line.rstrip('\n')
if line in allselectors:
times=allselectors.get(line)
allselectors[line]=times+1
total+=1
continue
else:
allselectors[line] = 1
continue
keylist = allselectors.keys()
keylist.sort()
#print total
for key in keylist:
times = allselectors[key]
percentage = float(times)/total
#print "%s" % key
#print "%s" % allselectors[key]
#print "%.2f" % percentage
print "%s : %s is %.2f" % (key, allselectors[key],percentage)
print ('*********************************************')
print (allselectors['#id'])
print (allselectors['.class'])
print (allselectors['tag'])