__author__ = 'WuJingyu' import sys goods = [ {"name": "苹果电脑", "price": 9999}, {"name": "iphoneX", "price": 5000}, {"name": "iWatch", "price": 1000}, {"name": "LV手提包", "price": 9999}, {"name": "Chanel", "price": 500} ] account_balance=None #账户余额 goods_of_relevant={} #goods中的商品进行拆分成【苹果电脑:9999】形式的字典并存储 goods_of_card=[] #待添加的购物车列表 first_login=None #是否第一次登录标记 #账户登录校验模块,允许用户登录错误3次,超过自动退出并提示 def account_auth(): count=3 with open("account.txt","r") as file: content=file.readline() name=content[content.find("=")+1:content.index("passwd")].strip() passwd=content[content.find("passwd=")+7:].strip() while True: user_name=input("请输入你的用户名:").strip() user_passwd=input("请输入你的密码:").strip() if user_name==name and user_passwd==passwd: print("恭喜登陆购物系统成功!!!"+" ") break else: count-=1 print("你的用户名或密码有误,请重新输入"+" "+ "