root/06/libkombilo-branches/hash_center_makedb/analyze.py

Revision 236, 443 bytes (checked in by ug, 1 year ago)

Fixed some issues with creating the frequency db.

Line 
1 from pysqlite2 import dbapi2
2
3 db = dbapi2.connect('t1.db2')
4 c = db.cursor()
5 c.execute('select freq from algo_hash_19_CENTER;')
6 a = c.fetchall()
7
8 d = {}
9 for card in a:
10     try:
11         d[card[0]] += 1
12     except KeyError:
13         d[card[0]] = 1
14
15 out = open('analyze.log', 'w')
16 for i in xrange(1,100000):
17     try:
18         out.write(str(i) + ' ' + str(d[i]))
19     except KeyError:
20         out.write(str(i) + ' 0')
21     out.write('\n')
22
23 out.close()
Note: See TracBrowser for help on using the browser.