设为首页 加入收藏

TOP

购物车--用户和商户入口(三)
2017-10-10 21:06:07 】 浏览:4182
Tags:购物车 用户 商户 入口
lock"):
list = []
with open("lock","r+") as f:
flag = 0
for line in f:
if line.strip() == "":
continue
line = eva l(line)
#判断账号是否存在
if line["name"] == _name:
line["num"] += 1
list.append(line)
else:
dict2 = {}
dict2["name"] = _name
dict2["num"] = 1
list.append(dict2)
with open("lock","w") as f1:
for i in list:
f1.write(str(i) + '\n')


#空文件直接写入
else:
list1 = []
dict1 = {}
dict1["name"] = _name
dict1["num"] = 1
list1.append(str(dict1))
with open("lock","w") as f2:
for j in list1:
f2.write(str(j) + '\n')

def main():
name = input("用户名:")
res = lock(name)
if res == 0:
print("%s已被冻结,请联系管理员"%name)
clear_lock()
exit()
passwd = input("密码:")
res1 = login(name,passwd)
if res1 == 0:
print("欢迎%s登陆CBD购物中心"%name)
while True:
shopping.main1(name)
elif res1 == 1:
print("密码错误")
write_lock(name)
else:
print("账号不存在")

res2 = lock(name)
if res2 == 0:
print("%s已被冻结,请联系管理员" %name)
clear_lock()
exit()

if __name__ == "__main__":
while True:
main()


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Python操作excel表格 下一篇python3精品解析运算符

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目