2018-05-25——PYTHON第五天

 class.enumeration(x,y)//打印可迭代的对象x,并给予编号,从y开始,默认不带编号

dic = {
"一班": {
"第一组": ["mmm", "www"],
"第二组": ["mmm1", "www2"],
},
"二班": {
"第一组": ["mmm", "www"],
"第二组": ["mmm1", "www2"],
}
}
li = []
go = True
while go:
for i, v in enumerate(dic, 1):
print(i, v)
li.append(v)
tmp = input('pause num to find、n to insert、r to return、q to quit\n')
if tmp.isdigit():
tmp = int(tmp)
li1 = []
while go:
for i, v in enumerate(dic[li[tmp - 1]], 1):
print(i, v)
li1.append(v)
tmp1 = input('pause num to find、r to return、q to quit\n')
if tmp1.isdigit():
tmp1 = int(tmp1)
while go:
for i in dic[li[tmp - 1]][li1[tmp1 - 1]]:
print(i)
tmp2 = input('pause num to find、r to return、q to quit\n')
if tmp2.isdigit():
tmp2 = int(tmp2)
elif tmp2.isalpha():
tmp2 = tmp2.lower()
if tmp2 == "r":
li1.clear()
break
elif tmp2 == 'q':
go = False
break
elif tmp1.isalpha():
tmp1 = tmp1.lower()
if tmp1 == 'r':
li1.clear()
break
elif tmp1 == 'q':
go = False
break
elif tmp.isalpha():
tmp = tmp.lower()
if tmp == 'r':
li1.clear()
break
elif tmp == 'q':
go = False
break
elif tmp == 'n':
bj = input('add class:\n')
if dic.get(bj, 1) == 1:
dic[bj] = {}

xz = input('add team:\n')
if dic[bj].get(xz, 1) == 1:
dic[bj][xz] = []
while True:
xm = input('add name:\n')
if xm == 'q':
break
if xm in dic[bj][xz]:
print('error')
else:
dic[bj][xz].append(xm)
li.clear()

################################################

0






猜你喜欢

转载自www.cnblogs.com/gulanmoen/p/9089006.html