# -*- coding: UTF8 -*-
import sqlite3 as sqlite
import xlrd , os , sys
from xlrd import open_workbook,empty_cell
def main():
conn = sqlite.connect("C:\\1111.db")
db = conn.cursor()
rb = open_workbook('C:\\1111.xls')
rs = rb.sheet_by_index(0)
db.execute("select name from sqlite_master where name='test'")
if db.fetchone():
print "Table exist"
else:
print "Table Create"
db.execute("create table test (nom_z text , current_year text , type_z text , type_o text , napr_z text , meta_z text , pidstava text ,data_n text ,data_o text , data_r text , data_v text , p_z text ,i_z text ,b_z text ,misto_z text ,vul_z text , bud_z text ,kv_z text,misto_o text,vul_o text, bud_o text ,kv_o text,notar text, tel text , meta_nom text , meta_data text , vlas_nm text,end text , termin text , dodatok text, nom_term text , data_term text , avans text , p text , i text , b text)")
for xxx in range(1,rs.nrows):
n1 = rs.cell(xxx,0).value
n2 = rs.cell(xxx,1).value
n3 = rs.cell(xxx,2).value
n4 = rs.cell(xxx,3).value
n5 = rs.cell(xxx,4).value
n6 = rs.cell(xxx,5).value
n7 = rs.cell(xxx,6).value
n8 = rs.cell(xxx,7).value
n9 = rs.cell(xxx,8).value
n10 = rs.cell(xxx,9).value
n11 = rs.cell(xxx,10).value
n12 = rs.cell(xxx,11).value
n13 = rs.cell(xxx,12).value
n14 = rs.cell(xxx,13).value
n15 = rs.cell(xxx,14).value
n16 = rs.cell(xxx,15).value
n17 = rs.cell(xxx,16).value
n18 = rs.cell(xxx,17).value
n19 = rs.cell(xxx,18).value
n20 = rs.cell(xxx,19).value
n21 = rs.cell(xxx,20).value
n22 = rs.cell(xxx,21).value
n23 = rs.cell(xxx,22).value
n24 = rs.cell(xxx,23).value
n25 = rs.cell(xxx,24).value
n26 = rs.cell(xxx,25).value
n27 = rs.cell(xxx,26).value
n28 = rs.cell(xxx,27).value
n29 = rs.cell(xxx,28).value
n30 = rs.cell(xxx,29).value
n31 = rs.cell(xxx,30).value
n32 = rs.cell(xxx,31).value
n33 = rs.cell(xxx,32).value
n34 = rs.cell(xxx,33).value
n35 = rs.cell(xxx,34).value
n36 = rs.cell(xxx,35).value
data33 = [(n1),(n2),(n3),(n4),(n5),(n6),(n7),(n8),(n9),(n10),(n11),(n12),(n13),(n14),(n15),(n16),(n17),(n18),(n19),(n20),(n21),(n22),(n23),(n24),(n25),(n26),(n27),(n28),(n29),(n30),(n31),(n32),(n33),(n34),(n35),(n36)]
db.execute(u"insert into test(nom_z , current_year , type_z , type_o , napr_z , meta_z , pidstava ,data_n ,data_o , data_r , data_v , p_z ,i_z ,b_z ,misto_z ,vul_z , bud_z ,kv_z ,misto_o ,vul_o , bud_o ,kv_o ,notar , tel , meta_nom , meta_data , vlas_nm ,end , termin , dodatok , nom_term , data_term , avans , p , i , b ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",data33)
db.close()
conn.commit()
conn.close()
if __name__ == '__main__' :
main()
Все работает но в базе весь текст имеет такую вот кодировку невизначено ((((( , подскажите как с этим можно бороться ?