资源简介
python 教务管理系统,实用mysql,简单实用,通过了测试,
代码片段和文件信息
#-*- coding:utf-8 -*-
#####系统登录
import os
import MySQLdb
import time
class Login:
def __init__(selfconn):
self.account = ‘‘
self.password = ‘‘
self.level = 2
self.conn = conn
def LoginSurface(selfinfo):
os.system(‘cls‘)
width = 50
title = ‘LOGIN‘
body1 = ‘[A]Admin‘
body2 = ‘[T]Teacher‘
body3 = ‘[S]Student‘
body4 = ‘[Q]Quit‘
print ‘=‘ * width
print ‘ ‘ * ((width-len(title))/2) title
print ‘ ‘ * ((width-len(body1))/2)body1
print ‘ ‘ * ((width-len(body1))/2)body2
print ‘ ‘ * ((width-len(body1))/2)body3
print ‘ ‘ * ((width-len(body1))/2)body4
print ‘ ‘ * ((width-len(info))/2) info
print ‘-‘ * width
def MainFunc(self):
err = ‘‘
while True:
self.LoginSurface(err)
level = raw_input(‘Access:‘)
level = level.upper()
if level == ‘A‘:self.level = 0
elif level == ‘T‘: self.level = 1
elif level == ‘S‘: self.level = 2
elif level ==‘Q‘: return False
else :
err = ‘Error Action!‘
continue
self.account = raw_input(‘Account:‘)
self.password = raw_input(‘Password:‘)
if self.CheckAccount():
err = ‘Login Success!‘
self.LoginSurface(err)
print ‘Please wait...‘
time.sleep(3)
return True;
else :
err = ‘Login Failed!‘
def GetLoginAccount(self):
return [self.accountself.passwordself.level]
def CheckAccount(self):
cur = self.conn.cursor()
sqlcmd = “select AccountPasswordAccountLevel from LoginAccount where Account = ‘%s‘“ % self.account
if cur.execute(sqlcmd) == 0: return False
temp = cur.fetchone()
cur.close()
if temp[1] == self.password and temp[2] == self.level:
return True
else: return False
def Quit(self):
pass
if __name__ == ‘__main__‘:
conn = MySQLdb.connect(user=‘root‘passwd = ‘123456‘db = ‘test‘);
a = Login(conn)
a.MainFunc()
a.Quit()
conn.close()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 19216 2018-05-14 20:42 SystemManager.py
文件 9034 2018-05-14 20:42 Teacher.py
文件 1921 2018-05-14 20:42 Login.py
文件 691 2018-05-14 20:42 main.py
文件 6817 2018-05-14 20:42 Student.py
----------- --------- ---------- ----- ----
37679 5
相关资源
- Python的Nmap模块
- python实现Apriori算法apriori.py和数据
- opc python 读取代码
- Python+Flask+sqlite实现的选课系统
- wxpython使用matplotlib的简单教程
- geoserver-rest-python-1.1
- leetcode python题解
- 基于SVM的手写字体识别Python版本
- Python RWR 可重启随机游走代码
- Python→Transorflow猫狗识别完整代码,附
- RPi.GPIO-0.6.3.tar
- python+rabird.winio实现驱动级模拟按键
- 基于wxPython和PySerial实现的串口助手
- Python Keras库 安装包
- python实现网络爬虫 爬取北上广深的天
- 正确可用的基于python实现的贝塞尔曲
- python3抓取头条新闻源码
- python.txt
- python版本selenium webdriver api
- _bz2.cpython-37m-x86_64-linux-gnu.so
- 树莓派与PC端在局域网内运用python实现
- Violent-Python-Source.zip
- python将矩形jpg图形批量裁剪为圆形图
- 彼岸网4K高清图片爬虫源代码
- gmpy2-2.0.8-cp38-cp38-win_amd64.whl
- 天天酷跑Python.docx
- python图像处理.rar
- cplex教程python
- python画图小程序
- Python袖珍指南Python Pocket Reference 第五
评论
共有 条评论