__author__ = 'root'
# -*- coding: utf-8 -*- ps = '/data/poitestdata/行政地名.csv'
pt = '/data/poitestdata/utf8_行政地名.csv'
perr = '/data/poitestdata/err_行政地名.csv'
f = open(ps)
f_ok = open(pt, 'w')
f_err = open(perr, 'w')
count_err = 0
count_ok = 0
while True:
line = f.readline()
if not line:
break
try:
line = line.decode('gbk')
except Exception:
f_err.write(line)
count_err += 1
continue
f_ok.write(line.encode('utf-8'))
count_ok += 1
f.close()
f_ok.close()
f_err.close()
print 'ok' + str(count_ok)
print 'err' + str(count_err)
print 'run over'
相关文章
- build/temp.linux-x86_64-2.7/_openssl.c:493:30: fatal error: openssl/opensslv.h: No such file or directory
- 管理Oracle的undo表空间和temp表空间
- 生产环境下JAVA进程高CPU占用故障排查---temp
- 解决ora-01652无法通过128(在表空间temp中)扩展temp段
- NAVICATE 修改存储过程提示PROCEDURE _Navicat_Temp_Stored_Proc already exists 解决方法
- ora-01652无法通过128(在表空间temp中)扩展temp段
- Command "python setup.py egg_info" failed with error code 1 in C:\Users\w5659\AppData\Local\Temp\pip-install-t7uomu4r\xa dmin\
- Win10电脑在运行中输入%temp%是什么意思?
- sort merge join导致temp被爆菊
- Can't create/write to file 'C:\WINDOWS\TEMP\...MYSQL报错解决方法