2022-3-2 15:04| 发布者: 笨鸟编程| 查看: 1343| 评论: 0
# coding=utf-8 #引入mysql python客户端模块 import MySQLdb import sys #进行数据库连接 conn= MySQLdb.connect(host="localhost", user="root", passwd="123456", db="pythontab", charset="utf8") cursor= conn.cursor() #执行sql cursor.execute("select * from test") #列出数据 records= cursor.fetchall() for rowin records: for rin row: print r
Archiver|手机版|笨鸟自学网 ( 粤ICP备20019910号 )
GMT+8, 2025-8-30 17:29 , Processed in 0.015426 second(s), 19 queries .
Powered by Discuz! X3.5
© 2001-2017 Discuz Team. Template By 【未来科技】【 www.wekei.cn 】