0
# -*-coding: UTF-8 -*-
import cx_Oracle
conn = cx_Oracle.connect('test/[email protected]/test')
cursor =conn.cursor()
f = open('test001.txt','r',encoding='gbk')
full_sql = f.read()
sql_commands = full_sql.split(';')
for sql_command in sql_commands:
cursor.execute(sql_command)}
系统错误:UnicodeEncodeError:“ASCII”编解码器不能在353-357位置编码字符:在范围序数不(128)使用cx_Oracle处理.SQL脚本
好像你不能真正阅读文件,但很难说这里有什么问题,除非你提供更多的信息,比如完整的堆栈跟踪。 你可以从test001.txt添加几行吗? –
从测试中删除其中TERM_ID ='2017-04'和TERM_VERSION_ID ='2017-04-01 插入测试(ID,ID2,ID3,ID4,ID5,ID6,ID7,ID8) values('test', null,'2017-04-01-2017-04-30','2017-04-01-2017-04-30_V_4','1','2','3',4) insert into test(ID ,ID2,ID3,ID4,ID5,ID6,ID7,ID8) values('test',null,'2017-04-01-2017-04-30','2017-04-01-2017-04-30_V_4 ','7','8','9',10) –
你安装了什么版本的cx_Oracle? –