Home  >  Article  >  Database  >  python与mysql连接的中文编码(在notepad++)_MySQL

python与mysql连接的中文编码(在notepad++)_MySQL

WBOY
WBOYOriginal
2016-06-01 13:06:103340browse

python

在python文件开始处加上: # -*- coding:utf8 -*-


MySQLdb的连接语句为: conn=MySQLdb.connect(host='localhost',user='root',passwd='1991618',db='wanfang',port=3306,charset='utf8')


notepad++的格式设置为: 以UTF-8无BOM编码

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn