python学生管理系统(控制台版) 使用类 构造函数

直接复制粘贴就能运行,如果报错导入一下datetime包应付作业用的所以代码写的的比较乱,应付作业的话直接复制就好了import datetime as datetimeteacher_list = [] # 教师列表student_list = [] # 学生列表login_teacher = "" # 当前登录教师admin_password = "" # 管理员密码# 目录类class PrintTxt: time = "" now_time = ""
摘要由CSDN通过智能技术生成

直接复制粘贴就能运行,如果报错导入一下datetime包

应付作业用的所以代码写的的比较乱,应付作业的话直接复制就好了

import datetime as datetime

teacher_list = []  # 教师列表
student_list = []  # 学生列表
login_teacher = ""  # 当前登录教师
admin_password = ""  # 管理员密码


# 目录类
class PrintTxt:
    time = ""
    now_time = ""
    def __init__(self):
        now = datetime.datetime.now()
        self.now_time = "日期: "+ now.strftime("%Y{}%m{}%d{}%H{}%M{}")\
            .format("年","月","日","时","分")
        now_time = now.strftime("%H")
        now_time=int(now_time)
        if now_time>0 and now_time<=6:
            self.time = "深夜了!"
        elif now_time >6 and now_time<=8:
            self.time = "早上好!"
        elif now_time >8 and now_time<=12:
            self.time = "上午好!"
        elif now_time >12 and now_time<=14:
            self.time = "中午好!"
        elif now_time >14 and now_time<=18:
            self.time = "下午好!"
        else:
            self.time = "晚上好!"
        print("学生管理系统:")

    def mulu(self):
        """打印分割线"""
        print("-" * 50)
        print("%s 欢迎使用学生管理系统--登录页面!\n\n1.教师登录\n"
              "2.教师注册\n3.教师列表\n4.教师修改\n5.教师删除\n\n0.退出系统\n\n%s" % (self.time,self.now_time))
        print("-" * 50)

    def student_mulu(self, username):
        """打印分割线"""
        print("-" * 50)
        print("%s 欢迎使用学生管理系统--学生管理页面--当前登录用户:"
              " %s \n\n1.学生列表\n2.新建学生\n3.修改学生\n4.删除学生\n\n0.返回上一页面\n\n%s" % (self.time,username,self.now_time))
        print("-" * 50)

    def teacher_list(self):
        print("-" * 50)
        print("账号\t|\t密码\t|\t教师名\t|\t创建时间\n")
        for teacher in teacher_list:
            print("%s\t|\t%s\t|\t%s\t|%s" % (
            teacher.username, teacher.password, teacher.teacher_name, teacher.create_time))

        print("-" * 50)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值