#coding=utf-
8
import sys
import MySQLdb
db = MySQLdb.connect(
"localhost",
"root",
"root",
"test", charset=
'utf8' )
cursor =
db.cursor()
sql=
"select * from runlist where issendmail=0 limit 1"
cursor.execute(sql)
data =
cursor.fetchone()
try:
if data!=
None: #数据不为空
print(data[1])
except ZeroDivisionError as e:
print('发生了异常:',e)
Python简单连接Mysql数据库。
转载于:https://www.cnblogs.com/mzpython/p/11014307.html
转载请注明原文地址: https://win8.8miu.com/read-12053.html