摘要: import MySQLdbimport MySQLdb.cursorscxn=MySQLdb.Connect(host='localhost',user='root',passwd='1234',db='db_name',port=3306,\ cursorclass=MySQLdb.cursor... 阅读全文
posted @ 2015-01-08 15:45 Beats 阅读(294) 评论(0) 推荐(0) 编辑
摘要: python 读取中文文件后,作为参数使用,经常会遇到乱码或者报错asii错误等。我们需要对中文进行decode('gbk')如我有一个data.txt文件有如下内容:百度谷歌现在想读取文件中内容构建查询语句代码如下:f=open('data.txt','r')for i in f.readline... 阅读全文
posted @ 2015-01-08 15:41 Beats 阅读(1166) 评论(0) 推荐(0) 编辑