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
|
import csv, sqlite3, re
con = sqlite3.connect("database2.db")
cur = con.cursor()
fin = open("i.csv", "rt")
for line in fin:
if re.search('[a-zA-Z]', line):
ins = "'" + line
ins = ins.replace('\n', '\'')
cur.execute("SELECT internal FROM presc_ids WHERE external LIKE "+ins+";");
else:
cur.execute("SELECT internal FROM presc_ids WHERE external = "+line+";")
pid = cur.fetchall()
print("% s" % pid[0] + ",")
con.commit()
con.close()
fin.close()
|