oding:utf-8
import MySQLdb
import sys
#建立和数据库的连接
db=MySQLdb.connect(host='rm-uf6m12',user="xx",passwd="xx",db = "sx_ls_pre")
#获取操作游标
cursor = db.cursor()
#执行sql
#cursor.execute("select mobile_code from ls_sms_log where user_phone='138*******' order by id desc LIMIT 1")
cursor.execute("select prod_id from ls_prod")
print cursor.fetchall()
#关闭连接,释放资源
db.close()
import MySQLdb
import sys
#建立和数据库的连接
db=MySQLdb.connect(host='rm-uf6m12',user="xx",passwd="xx",db = "sx_ls_pre")
#获取操作游标
cursor = db.cursor()
#执行sql
#cursor.execute("select mobile_code from ls_sms_log where user_phone='138*******' order by id desc LIMIT 1")
cursor.execute("select prod_id from ls_prod")
print cursor.fetchall()
#关闭连接,释放资源
db.close()