数据库
数据库¶
[python3教程][10]
-
连接MySQL:
1 2 3 4 5
db = pymysql.connect(host='localhost', port=3306,user='root',passwd='2005726',db='review') cur = db.cursor() self.db = db self.cur = cur self.fetch_data()
-
读取数据:
1 2 3 4 5 6
train = [] self.cur.execute("SELECT * FROM Bug_Report_Data") for row in self.cur: review = str(row[16]) review= str(review.decode('utf-8', errors='ignore')) train.append((review, 'bug'))
使用pymysql连接Mysql¶
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
评论
作者: