<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      不畏懼

      博客園 首頁 新隨筆 聯系 訂閱 管理

      題目為信用卡消費管理系統:

       

      主程序:main.py

      #!usr/bin/env python
      # encoding: utf-8
      import conf,sys,time,re,os
      import json
      import login
      tmp_dic = {}
      
      def shopping_center(arg):
          print('\033[32mWelcome into Credit card store!\033[0m')
          while True:
              for i,(k,v) in enumerate(conf.shop_list.items(),1):
                  print('%s.%s:%s'%(i,k,v))
              N = int(input('Please select you want to buy goods(input r:return p:pay):').strip())
              if N == 7:
                  print('\033[31myou will return main list!\033[0m')
                  time.sleep(1)
                  tmp_dic.clear()#返回后如果沒有支付則清空購物車
                  break
      
              elif N in range(1,len(conf.shop_list)-1):
                  key = list(conf.shop_list.items())[N - 1][0]
                  value = list(conf.shop_list.items())[N - 1][1]
                  if key in tmp_dic.keys():
                      tmp_dic[key] = tmp_dic[key] + value
                  else:
                      tmp_dic[key] = value
                  print('\033[35mYour shopping cart is as follows:\033[0m')
                  for x,y in tmp_dic.items():
                      print('\033[35m%-5s:%s\033[0m'%(x,y))
              elif N == 8:
                  print('\033[33mThe total order for you:%s\033[0m'%sum(tmp_dic.values()))
                  sum_values = sum(tmp_dic.values())
                  with open('account.json','r') as f:
                      acc = json.load(f)
                  if sum_values > acc[arg][2]:
                      print('對不起你的信用卡額度不足,請重新購買!!')
                      login.log_record(arg, '消費', sum_values, 'fail')
                      tmp_dic.clear()
                      break
                  else:
                      acc[arg][2] = acc[arg][2] - sum_values
                      acc[arg][3] = acc[arg][3] + sum_values
                      with open('account.json','w') as z:
                          json.dump(acc,z)
                      login.log_record(arg,'消費',sum_values,'success')
                      print('恭喜你購物成功即將返回主菜單!!')
                      time.sleep(1)
                      tmp_dic.clear()
                      break
      
      #信用卡管理
      def card_center(name):
          if name == 'admin':
              print('歡迎%s進入信用卡管理系統'%name)
              while True:
                  for index,i in enumerate(conf.ad_list,1):
                      print('%s.%s' %(index,i))
                  p = int(input('請選擇你要的操作的編號:').strip())
                  with open('account.json', 'r+') as f:
                      acc = json.load(f)
                  if p == 1:#添加用戶
                      key = input('請輸入你的用戶名:').strip()
                      pawd = input('請輸入密碼:').strip()
                      paws = input('請輸入支付密碼:').strip()
                      acc[key] = [pawd, paws, 15000,0, "unlock"]
                      with open('account.json', 'w') as x:
                          json.dump(acc,x)
                      print('用戶%s已經添加成功額度為15000'%key)
      
                  elif p == 2:#用戶額度調整
                      n = input('你的賬號:')
                      limit = int(input('請輸入你要的額度:').strip())
                      if n in acc.keys():
                          acc[n][2] = limit
                          with open('account.json','w') as y:
                              json.dump(acc,y)
                          continue
                  elif p == 3:#凍結賬戶
                      freeze = input('請輸入你要凍結的賬戶:').strip()
                      acc[freeze][3] = "lock"
                      with open('account.json', 'w') as z:
                          json.dump(acc, z)
                      print('賬號%s已凍結'%freeze)
                      continue
                  elif p == 4:#解凍賬戶
                      unfreeze = input('請輸入你要解凍的賬戶:')
                      acc[unfreeze][3] = "unlock"
                      with open('account.json','w') as g:
                          json.dump(acc,g)
                      print('賬戶%s已解凍'%unfreeze)
                      continue
                  elif p == 5:#用戶操作查詢
                      pass
                      continue
                  elif p == 6:#返回主菜單
                      break
          else:#消費者信用卡管理系統
              print('\033[34m歡迎進入消費者信用卡管理系統!\033[0m')
              with open('account.json', 'r+') as e:
                  acc1 = json.load(e)
              while True:
                  for l,i in enumerate(conf.customer_list,1):
                      print('%s.%s'%(l,i))
                  custom_in = int(input('請選擇你需要的操作:').strip())
                  if custom_in == 1:
                      print('#' * 20)
                      print('賬戶:%s\n額度:%s\n待還款:%s' %(name,acc1[name][2],acc1[name][3]))
                      print('#' * 20)
                      continue
                  elif custom_in == 2:
                      print('你的還款額:%s'%acc1[name][3])
                      huank = int(input('你要還多少:').strip())
                      acc1[name][2] = acc1[name][2] + huank
                      acc1[name][3] = acc1[name][3] - huank
                      with open('account.json', 'w') as g:
                          json.dump(acc1, g)
                      print('恭喜你還款成功!')
                      continue
                  elif custom_in == 3:
                      qukuan = int(input('請輸入你要取款的金額:').strip())
                      acc1[name][2] = acc1[name][2] - qukuan
                      acc1[name][3] = acc1[name][3] + qukuan
                      with open('account.json', 'w') as h:
                          json.dump(acc1, h)
                      continue
                  elif custom_in == 4:
                      print('你的消費記錄如下')
                      ff = open('record.log','r')
                      for line in ff:
                          if name in line:
                              print(line)
                      ff.close()
                      print('-'*20)
                      continue
                  elif custom_in == 5:
                      while True:
                          pa = input('請輸入你要轉賬的賬戶:').strip()
                          pc = int(input('請輸入你要轉賬的金額:').strip())
                          if pa not in acc1.keys():
                              print('你輸入的賬戶不存在,請重新輸入!')
                              continue
                          elif pc > acc1[name][2]:
                              print('你的轉賬額度不夠,請重新輸入!')
                              continue
                          else:
                              break
                      acc1[pa][3] = acc1[pa][3] - pc
                      acc1[pa][2] = acc1[pa][2] + pc
                      acc1[name][2] = acc1[name][2] - pc
                      acc1[name][3] = acc1[name][3] + pc
                      with open('account.json','w') as dd:
                          json.dump(acc1,dd)
                      print('恭喜你轉賬成功!')
                      continue
                  elif custom_in == 6:
                      break
                  else:
                      print('你選擇的編號不對,請重新輸入!!')
                      continue
      
      
      if __name__ == "__main__":
          while True:
              print('\033[32mWelcome into credit card store!!!\033[0m')
              for index,i in enumerate(conf.main_list,1):
                  print('%s.%s'%(index,i))
              Num = input('Please choose you to enter the system(input b exit):').strip()
              if Num == 'b':
                  print(1)
                  sys.exit()
              elif int(Num) == 1:
                  name1 = login.login()
                  card_center(name1)
                  continue
              elif int(Num) == 2:
                  name = login.login()
                  shopping_center(name)
                  continue

      配置文件:conf.py

       

      #!usr/bin/env python
      # encoding: utf-8
      main_list = ['Credit card supervise','Credit card store']
      
      shop_list = {'Car':100000,
                   'Iphone':5000,
                   'Mac Book':8000,
                   'pan':10,
                   'T-shirt':100,
                   'coffee':30,
                   'return':'返回主菜單',
                   'pay':'買單',
                   }
      
      ad_list = ['添加用戶','用戶額度調整','凍結賬戶','解凍賬戶','用戶操作查詢','返回上一級']
      customer_list = ['賬戶查詢','還款','提現','消費查詢','轉賬','返回']

       

       登錄系統和日志系統:login.py

      #!usr/bin/env python
      # encoding: utf-8
      
      import json,sys,time
      # account = {'wyh':['a123',123,15000,'unlock'],
      #            'bat':['b321',456,15000,'unlock'],
      #            'admin':['admin',0,0,'unlock']}
      # with open('account.json','w') as d:
      #     json.dump(account,d)
      logfile = 'record.log'
      
      def login():
          with open('account.json', 'r') as f:
              acc = json.load(f)
          i = 0
          while True:
              name = input('請輸入賬號:')
              password = input('請輸入密碼:')
              if acc[name][3] == 'lock':
                  print('你的賬戶被鎖定請聯系你的客戶經理!!!')
                  sys.exit()
              elif name not in acc.keys() or password != acc[name][0] :
                  print('你的賬戶信息請重新輸入!!!')
                  i += 1
                  if i > 2:
                      print('你的賬戶被鎖定請聯系你的客戶經理確認你的賬戶安全!!')
                      acc[name][3] = 'lock'
                      with open('account.json', 'w') as f1:
                          json.dump(acc, f1)
                      sys.exit()
                  continue
              else:
                  print('歡迎%s'%name)
                  return name
      
      def log_record(name,Status,money,description='Null'):
          date = time.strftime("%Y%m%d %H:%M:%S", time.localtime())
          record_line = "%s  %s   %s  %s  %s\n" % (date, name, Status,money, description)
          f = open(logfile, 'a')
          f.write(record_line)
          f.flush()
          f.close()

       

       賬號文件:account.json

      {"wyh": ["a123", 123, 14870, 100, "unlock"], "bat": ["b321", 456, 10070, 4930, "unlock"], "admin": ["admin", 0, 0, 0, "unlock"]}

       

      posted on 2017-05-16 23:15  不畏懼  閱讀(224)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲天堂在线观看完整版| 色综合久久精品中文字幕| 少妇高潮喷水在线观看| 国产亚洲av夜间福利香蕉149| 免费人成年激情视频在线观看| 9lporm自拍视频区| 亚洲全乱码精品一区二区| 久久日韩在线观看视频| 亚洲深夜精品在线观看| 免费无码一区二区三区蜜桃大| 亚洲情A成黄在线观看动漫尤物| 久久精品国产99国产精品严洲| 亚洲码国产精品高潮在线| 天堂va亚洲va欧美va国产| 国产丰满乱子伦午夜福利| 毛片无遮挡高清免费| 最新午夜男女福利片视频| 欧美亚洲另类自拍偷在线拍| 越南毛茸茸的少妇| 国自产拍偷拍精品啪啪模特| 亚洲中文字幕在线观看| 亚洲日韩国产成网在线观看| 三级国产在线观看| 少妇人妻系列无码专区视频| 免费av深夜在线观看| 国产精品疯狂输出jk草莓视频| AV区无码字幕中文色| 激情综合五月| 国产精品久久香蕉免费播放| 精品人妻伦一二三区久久aaa片| 欧美三级在线播放| 狠狠躁夜夜躁人人爽天天5| 中文字幕日韩精品有码视频 | 亚洲一区二区三区18禁| 欧美成人精品手机在线| 中国女人熟毛茸茸A毛片| 色成人精品免费视频| 国产精品久久久久久无毒不卡| 亚洲女人天堂成人av在线| 国产男女猛烈无遮挡免费视频网站 | 亚洲一区精品视频在线|