Python电影售票系统(第三个小程序)

【Python电影售票系统(第三个小程序)】import re, time
def users_login(x, y, z):

account = input('请您输入账号:') password = input('请您输入密码:') if account in x: if x[account][0] == password: time.sleep(0.5) print('密码正确,登录成功!') while True: operation = input('请您选择操作(1.会员信息 2.购买影票 3.购票信息 4.影票退订 5.修改信息 6.退出系统):') if operation == '1': time.sleep(0.5) print('*' * 7 + '会员信息' + '*' * 7) print('会员卡号:{}'.format(account)) print('会员昵称:{}'.format(x[account][1])) print('会员性别:{}'.format(x[account][2])) print('手机号码:{}'.format(x[account][3])) print('*' * 21) elif operation == '2': time.sleep(0.5) print('*' * 3 + '电影放映表' + '*' * 3) for a, b in list(enumerate(y, 1)): print(a, b['name']) print('*' * 13) buy = int(input('请您选择电影场次:')) time.sleep(0.5) print('*' * 8 + '电影信息' + '*' * 8) print('影名:{}'.format(y[buy - 1]['name'])) print('类别:{}'.format(y[buy - 1]['category'])) print('导演:{}'.format(y[buy - 1]['director'])) print('演员:{}'.format(y[buy - 1]['actor'])) print('*' * 23) while True: time.sleep(0.5) print('*' * 13 + '影厅座位' + '*' * 13) for i in y[buy - 1]['seat']: print(''.join(i)) print('*' * 32) choose = input('是否继续购票(1.继续 2.退出):') if choose == '2': break line_numbers = int(input('请您选择影厅行号:')) seat_numbers = int(input('请您选择影厅座号:')) if y[buy - 1]['seat'][line_numbers][seat_numbers] == '■': print('不好意思,座位已选!') else: y[buy - 1]['seat'][line_numbers][seat_numbers] = '■' time.sleep(0.5) print('购票成功,电影名:{} 座位号:{}排{}号'.format(y[buy - 1]['name'], line_numbers, seat_numbers)) if account in z and y[buy - 1]['name'] in z[account]: z[account][y[buy - 1]['name']].append( '{}排{}号'.format(line_numbers, seat_numbers)) elif account in z and y[buy - 1]['name'] not in z[account]: z[account][y[buy - 1]['name']] = [ '{}排{}号'.format(line_numbers, seat_numbers)] else: z[account] = { y[buy - 1]['name']: ['{}排{}号'.format(line_numbers, seat_numbers)]} elif operation == '3': if account in z: for i in z[account]: time.sleep(0.5) print('卡号:{} 昵称:{} 影名:{} 座位:{}'.format (account, x[account][1], i,' '.join(z[account][i]))) else: print('未查询到购票信息') elif operation == '4': if account in z: for i in z[account]: time.sleep(0.5) print('卡号:{} 昵称:{} 影名:{} 座位:{}'.format(account, x[account][1], i,

'.join(zaccount)))
print('[金属期货](https://www.gendan5.com/cf/mf.html)未查询到订票信息') while True: unsubscribe = input('是否需要退订影票(1.需要 2.退出):') if unsubscribe == '2': break else: name = dict(enumerate(z[account], 1)) for i in name: print(i, name[i]) movie_number = int(input('请您选择需要退票电影序号:')) number = dict(enumerate(z[account][name[movie_number]], 1)) for i in number: print(i, number[i]) seat_number = int(input('请您选择需要退票电影座位:')) message = re.findall(r'\d+', number[seat_number]) for i in y: if name[movie_number] == i['name']: i['seat'][int(message[0])][int(message[1])] = '□'

zaccount].remove(number[seat_number])
time.sleep(0.5) print('退票成功!') if not z[account][name[movie_number]]: del z[account][name[movie_number]] elif operation == '5': time.sleep(0.5) print('*' * 7 + '会员信息' + '*' * 7) print('会员卡号:{}'.format(account)) print('会员昵称:{}'.format(x[account][1])) print('会员性别:{}'.format(x[account][2])) print('手机号码:{}'.format(x[account][3])) print('*' * 21) while True: modify = input('是否继续修改(1.继续 2.退出):') if modify == '2': break choose = input('请您选择修改内容(1.会员昵称 2.会员性别 3.手机号码):') if choose == '1': x[account][1] = input('请输入会员昵称:') elif choose == '2': x[account][2] = input('请输入会员性别:') elif choose == '3': x[account][3] = input('请输入手机号码:') elif operation == '6': print('系统退出成功,欢迎下次使用!') break else: print('密码错误,登录失败!') else: print('账号错误,请您核对!')

    推荐阅读