python-学生管理系统--5 统计学生总人数功能

发布于:2023-07-04 ⋅ 阅读:(108) ⋅ 点赞:(0)

 

 

# 统计学生总人数
def total():
    if os.path.exists(filename):
        with open(filename,'r',encoding='utf-8') as rfile:
            students=rfile.readlines()

            if students:
                print("一共有{}名学生。".format(len(students)))
            else:
                print("还没有录入学生信息。")

    else:
        print("暂未保存数据信息....")


网站公告

今日签到

点亮在社区的每一天
去签到