TA的每日心情 | 无聊 2018-5-10 09:16 |
---|
签到天数: 172 天 连续签到: 2 天 [LV.7]测试师长
|
python如何处理多条不同的SQL语句呢?以下2条select * from user_info;
SELECT * FROM sms_verifycode WHERE mobile='18100000000' order by id desc
def sql():
db=pymysql.connect(host="test.xxx.cn",user="xxx",password="6trdHSfTxxx",db="xxxx",port=330x)
cursor=db.cursor()
sql="SELECT * FROM sms_verifycode WHERE mobile='18100000000' order by id desc"
cursor.execute(sql)
results=cursor.fetchall()
#results1=cursor.fetchone()
'''
for row in results:
code = row[1]
return code
'''
print(results)
sql()
|
|