当前位置:Gxlcms > 数据库问题 > Python基础之Mysql

Python基础之Mysql

时间:2021-07-01 10:21:17 帮助过:24人阅读

coding=utf-8 import pymysql conn=pymysql.connect(host="127.0.0.1",port=3306,user="root",passwd="root",db="dgcms",charset="utf8") cur=conn.cursor() sql="select * from blog" cur.execute(sql) rows = cur.fetchall() for dr in rows: print(dr)

调用代码:

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from jinjiemysql import *
(7, VB.NET, VB.NET)
(3, go go, er3r53r5)
(4,   C#, RWRRWWW)
(6, object c, object c)
(5, python, haaaa)
>>> 

 

Python基础之Mysql

标签:nec   log   for   obj   license   bsp   info   div   odi   

人气教程排行