python链接mysql
import pymysql
conn = pymysql.connect(user=‘user1‘, password=‘123456‘, database=‘gbt2019‘, charset=‘utf8‘)
cursor = conn.cursor()
query = (‘select id, title from data_2019100501‘)
cursor.execute(query)
for (id, title) in cursor:
print(id, title)
cursor.close()
conn.close()
查看更多关于python链接mysql pymysql的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did170777