随笔分类 -  python

摘要:conn = pymysql.connect( host='127.0.0.1', port=3302, user='username', passwd='password', db=database, charset='utf8') #此处要指定charset为utf-8(一般数据库编码都是utf8或utf8mb4之类),否则读取出的中文会乱码 阅读全文
posted @ 2016-06-07 16:05 殊胜 阅读(8758) 评论(1) 推荐(1)
摘要:file = open(filename,'a',encoding='utf8')#指定写入编码为utf8,否则写入中文会乱码 阅读全文
posted @ 2016-06-07 16:03 殊胜 阅读(13564) 评论(0) 推荐(1)