import os
import sys
path_py = os.path.split( os.path.realpath( sys.argv[0] ) )[0] #脚本所在目录
path_ID_list = path_py + "/ID_list/" #名单文件所在目录
ID_list_all = os.listdir(path_ID_list) #名单文件列表
def fuc_9():
print("\n------welcome------")
print("1.成员管理\n2.时间查询")
print("3.名单文件管理\n4.帮助")
print("0.退出\n")
a = input("输入:")
def choice_0(a):
if a == "1":
fuc_1()
elif a == "2":
fuc_2()
elif a == "3":
fuc_3()
elif a == "4":
help_4()
elif a == "0":
exit_0()
else :
print("请重新输入正确的选项:")
a = input("输入:")
choice_0(a)
choice_0(a)
def exit_0():
return 0
#------------------------------------------#
def fuc_1():
print("-------------------")
print("若所要编辑的成员名单文件不存在")
print("请返回首页进入名单文件管理功能")
print("1.1录入新成员")
print("1.2查询成员信息")
print("1.3更改成员信息")
print("1.4删除成员信息\n")
print("9.返回首页")
print("0.退出\n")
a = input("输入:")
def choice_1(a):
if a == "1" or a == "1.1" :
fuc_1_1()
elif a == "2" or a == "1.2":
fuc_1_2()
elif a == "3" or a == "1.3":
fuc_1_3()
elif a == "4" or a == "1.4":
fuc_1_4()
elif a == "0":
exit_0()
elif a == "9":
fuc_9()
else :
print("请重新输入正确的选项:")
a = input("输入:")
choice_1(a)
choice_1(a)
def fuc_1_1():
print("选择成员名单:" + str(ID_list_all))#输出所有成员名单文件
#bug
def is_ID_list():
a = input("输入:")
a = str(path_ID_list) + a
if os.path.isfile(a) == False:
print("请重新输入正确的选项:")
is_ID_list()
else:
return a
a = is_ID_list()
print (a)
#bug
def ID_write(a):
f = open(a, 'w+')
Wr = input("成员姓名:")
f.write(Wr + " ")
Wr = input("年级:")
f.write(Wr + " ")
Wr = input("所在学院:")
f.write(Wr + " ")
Wr = input("部门:")
f.write(Wr + " ")
Wr = input("分组:")
f.write(Wr + " \n" )
f.flush()
f.close()
f = open(a, 'r')
x = f.readlines()
print("请确认所输入的信息:")
print(str(x[len(x)-1]))
Y_N = input("信息是否正确 Y/N : ")
def Yes_No(Y_N):
if Y_N == "y" or Y_N == "Y":
f.flush()
f.close()
print("新成员信息成功录入")
fuc_9()
elif Y_N == "n" or Y_N == "N":
del x[len(x)-1]
print("")
ID_write()
else:
print("请重新输入正确的选项:")
Y_N = input("输入:")
Yes_No(Y_N)
Yes_No(Y_N)
ID_write(a)
def fuc_1_2():
a = input("输入:")
def fuc_1_3():
a = input("输入:")
def fuc_1_4():
a = input("输入:")
#------------------------------------------#
def fuc_2():
print("-------------------")
print("2.1按时间查询")
print("2.2按名单查询\n")
print("9.返回首页")
print("0.退出程序\n")
a = input("输入:")
def choice_2(a):
if a == "1":
fuc_1_1()
elif a == "2":
fuc_1_2()
elif a == "0":
exit_0()
elif a == "9":
fuc_9()
else :
print("请重新输入正确的选项:")
a = input("输入:")
choice_2(a)
choice_2(a)
def fuc_2_1():
a = input("输入:")
def fuc_2_2():
a = input("输入:")
#------------------------------------------#
def fuc_3():
print("-------------------")
print("成员名单文件列表:\n") #输出所有成员名单文件名
print("3.1新建成员名单文件")
print("3.2总览成员名单文件")
print("3.3修改成员名单文件")
print("3.4删除成员名单文件\n")
print("9.返回首页")
print("0.退出\n")
a = input("输入:")
def choice_3(a):
if a == "1" or a == "3.1" :
fuc_3_1()
elif a == "2" or a == "3.2":
fuc_3_2()
elif a == "3" or a == "3.3":
fuc_3_3()
elif a == "4" or a == "3.4":
fuc_3_4()
elif a == "0":
exit_0()
elif a == "9":
fuc_9()
else :
print("请重新输入正确的选项:")
a = input("输入:")
choice_3(a)
choice_3(a)
def fuc_3_1():
a = input("输入:")
def fuc_3_2():
a = input("输入:")
def fuc_3_3():
a = input("输入:")
def fuc_3_4():
a = input("输入:")
#------------------------------------------#
def help_4():
print("-------------------")
#在屏幕上显示完整帮助文档
print("0.退出\n")
fuc_9()