16f90fbc
Eduardo Eloy
database and impl...
|
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
|
import csv, sqlite3
con = sqlite3.connect("database2.db")
cur = con.cursor()
fin = open("i.csv", "rt")
for line in fin:
if '_' in line:
ins = "'" + line
ins = ins.replace('\n', '\'')
cur.execute("SELECT internal FROM ug_ids WHERE external LIKE "+ins+";");
ugid = cur.fetchall()
print("% s" % ugid[0] + ",")
elif '-1' in line:
print("-1,")
else:
cur.execute("SELECT internal FROM ug_ids WHERE external = "+line+";")
ugid = cur.fetchall()
print("% s" % ugid[0] + ",")
con.commit()
con.close()
fin.close()
|