#!/usr/bin/env python # -*- coding: utf-8 -*- import sqlite3 import csv writer = csv.writer(file('result.csv','w'),lineterminator="\n",quoting = csv.QUOTE_ALL) con = sqlite3.connect(':memory:') cur = con.cursor() sql2 = "SELECT * FROM (SELECT * FROM tweet" for i in xrange(1,10): #dbファイルの数 sql = "ATTACH DATABASE 'tweet%d.db' as tweet%d" % (i,i) con.execute(sql) con.commit() sql2 = sql2 + """ UNION