나는 source.sql 읽기 (SQL 스크립트) 파일파이썬 인코딩 문제?
INSERT INTO `Tbl_abc` VALUES (1111, 2222, 'CLEMENT', 'taya', 'MME', 'Gérant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 4688, 0, NULL, NULL, 'MAILLOT 01/02/09', 'MAILLOT 01/04/09', NULL, NULL);
그리고 예를 들어 인코딩 문제를 충족
내 목록 형식의
의 의 으로 dest.sql에 쓸 :Gérant= G\xc3\xa9rant
무엇 내가 노력하고
def DataMigration(dest, source, tbl_name, return_data=True):
'''
'''
data = []
for ln in codecs.open(source, 'r', "utf-8").xreadlines():
replace1 = ln.replace("INSERT INTO `"+tbl_name+"` VALUES (", "")
replace2 = replace1.replace(");", "")
list_replace = replace2.split(',')
s = list_replace
data.append(list_replace)
if return_data == True:
ouputdata = [d for d in data if d[1] == ' 0' and d[6]==' 0']
return ouputdata
if return_data == False:
return data
내가 인쇄 DataMigration 인쇄 ('dest.sql', '.source.sql을', 'Tbl_abc'거짓)
OUTPUT
[['1111', ' 2222', " 'CLEMENT'", " 'taya'", " 'MME'", " 'G\xc3\xa9rant'", ' NULL', ' NULL', ' NULL', ' NULL', ' NULL', ' NULL', ' NULL', ' 4688', ' 0', ' NULL', ' NULL', " 'MAILLOT 01/04/09'", " 'MAILLOT 01/04/09'", ' NULL', ' NULL']]
But My Ouput file still has the problem.Any Could help me ?
그냥 생각 : 테이블 정의를 확인 했습니까? – jensgram
내 queston을 업데이트했습니다. 의견을 주셔서 감사합니다. – kn3l
예 원인 : 프랑스어 사용 – kn3l