赞
踩
mysql.connector
#先安装mysql-connector:pip install mysql-connector import mysql.connector #1)数据库查询 #连接数据库 conn=mysql.connector.connect( host="localhost", user="root", password="1234", database="test" ) print(conn) cmd=conn.cursor() #获取光标行 cmd.execute("show databases") #执行语句 for i in cmd: print(i) cmd.execute("select * from student ") # rus=cmd.fetchall() #抓取所有的数据 # print(rus) rus2=cmd.fetchone(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。