--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/txt2db.py Thu May 18 22:59:47 2006 +0200
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import shelve,string,os
+
+
+sourcefile = 'vortoj-ru-ca.txt'
+dbfile = 'vortoj-ru-ca.sdb'
+try:
+ os.remove(dbfile)
+except:
+ print "File '%s' doesn't exist. Creating..." % dbfile
+else:
+ print "File '%s' exist. Wipping..." % dbfile
+
+dbase = shelve.open(dbfile)
+
+# Read txt
+file = open(sourcefile, 'r')
+
+for line in file:
+ line = line.rstrip('\n')
+ words = string.split(line, '\t')
+ print "Adding:", words[0], '=>', words[2]
+ dbase[words[0]] = words[2]
+
+file.close()
+
+dbase.close()