tweetcast/nodejs/sqlite2txt.py
changeset 410 bf5cf5a9e737
parent 409 f7ceddf99d6d
parent 406 86b62b98fea7
child 411 0471e6eb8a1b
child 412 97c082990f8d
--- a/tweetcast/nodejs/sqlite2txt.py	Wed Dec 07 19:28:46 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import sqlite3, sys, os.path, codecs, re
-
-if len(sys.argv) > 1:
-    filename = sys.argv[1]
-    if os.path.exists(filename):
-        print "Chargement du fichier %s" % filename
-        conn = sqlite3.connect(filename)
-        c = conn.cursor()
-        c.execute("SELECT json FROM tweets")
-        f = codecs.open("%s.txt" % filename, mode='w', encoding='utf-8')
-        for r in c:
-            txt = ''
-            t = re.split("&#([0-9]+);",r[0])
-            for i in range(len(t)):
-                txt += ( ( '\\u' + hex(int(t[i])).replace('0x','').rjust(4,'0') ) if i % 2 else t[i] )
-            f.write(u'%s\n' % txt)
-        f.close()
-        print "Le fichier %s.txt a ete cree" % filename
-    else:
-        print "Le fichier n'existe pas"
-else:
-    print "Merci de preciser le nom du fichier"
\ No newline at end of file