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

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

WBOY
Release: 2016-06-01 13:06:10
Original
3388 people have browsed it

python

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


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


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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template