#!/usr/bin/env python # -*- coding:utf-8 -*- import pymysql import time conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='log') cursor = conn.cursor(cursor=pymysql.cursors.DictCursor) # 账户' -- fds 输入 密码随便输入 name = input('>>>') pwd = input('>>>') effect_row = cursor.execute("select user,pwd from log where user='%s' and pwd='%s'"%(name,pwd,)) result = cursor.fetchone() conn.commit() cursor.close() conn.close() if result: print(result) print('登录成功') else: print('失败')