sudo pip install MySQL-python
# import xlrd
import MySQLdb.cursors
conn=MySQLdb.connect(host='ip',
user='user',
passwd='password',
db='db name',
charset='utf8')
cursor = conn.cursor()
cursor.execute ("select * from tablename")
row = cursor.fetchall()
cursor.close()
conn.close()
python 2.7 连接mysql
猜你喜欢
转载自blog.csdn.net/haogeoyes/article/details/83995605
今日推荐
周排行