Blame view

MODFIRE-Prototype/res/initialize_ugs.py 450 Bytes
16f90fbc   Eduardo Eloy   database and impl...
1
2
import csv, re, sqlite3

a4f37eed   Eduardo Eloy   initizalyzers for...
3
con = sqlite3.connect("database2.db")
16f90fbc   Eduardo Eloy   database and impl...
4
cur = con.cursor()
a4f37eed   Eduardo Eloy   initizalyzers for...
5
f = open("ugs_init", "w+")
16f90fbc   Eduardo Eloy   database and impl...
6
7
8

toWrite = ''

a4f37eed   Eduardo Eloy   initizalyzers for...
9
10
for i in range(0, 1373):
	cur.execute("SELECT distinct presc FROM action where ug like "+str(i)) 
16f90fbc   Eduardo Eloy   database and impl...
11
12
	result = cur.fetchall()
	if(result == []):
2cd288b3   Eduardo Eloy   project can now i...
13
		toWrite = "0\n"
16f90fbc   Eduardo Eloy   database and impl...
14
15
16
17
	else:
		for j in range(0, len(result)):	
			toWrite += str(result[j]).replace(')','').replace('(','')
		toWrite = toWrite[:-1]+"\n"
a4f37eed   Eduardo Eloy   initizalyzers for...
18
19
	f.write(toWrite)
	toWrite = ''
16f90fbc   Eduardo Eloy   database and impl...