目前,python的csv包还不能直接处理utf文档,所以读出后必须处理以下
如果要将含有中文ANSI文档的内容添加到数据库中,也是一样的
python 代码
- for row in reader:
- yield [unicode(cell, 'utf-8') for cell in row]
python 代码
- for row in reader:
- yield [unicode(cell, 'gb2312') for cell in row]
本文介绍如何使用Python处理包含UTF-8和GB2312编码的CSV文件,并将其内容导入数据库的方法。
1430

被折叠的 条评论
为什么被折叠?



