ReadMe:

  1. 注意事项:
  2. 1.本程序需要提前安装prettytable模块,在商品展示时使用了prettytable
  3. 2.数据库使用json模块,有中文数据,在mac系统上编写,运行没有出现问题,在其他系统上运行时入出现编码问题请转换编码格式
  4.  
  5. 一些需求修改的说明:
  6. 1.Alex在布置这个商城作业时,选择物品即自动扣款,但在正常的电商购物流程,是需要先加入购物车结算时扣款,所以我使用了结算时扣款的流程,但充值的金额会模拟扣款
  7. 2.用户第二次登陆时会读取上次未结账的商品,自动加入购物车,并会提醒用户如结账后的预计金额
  8.  
  9. 文件说明:
  10. user_info:json文件,存储相应的用户信息,包括账号,密码,账户余额以及购物历史记录
  11. goods_info:json文件,存储商品的详情,包括名称,库存,价格等
  12. save_cart:json文件,存储信息为:用户加入购物车并未结账退出时的购物车商品列表,以便第二次登陆时继续购物
  13. user_lock:普通文件,保存已被锁定用户账号信息.
  14.  
  15. 功能测试账号:cc 密码:123 也可注册一个账号来测试
  16.  
  17. 功能介绍:
  18. 1.此程序为一个购物电商程序,在命令行运行
  19. 2.运行时需要登陆,如果密码三次错误,会将此用户锁定,以后不能再登陆
  20. 3.账号注册:运行程序后,输入一个数据库中没有的账号,会提示无此账号,是否注册新用户,当然注册时密码验证超过三次会注册失败
  21. 4.充值功能:用户在主菜单可选择充值功能,直接输入金额即可,充值完成后会提示账户余额
  22. 5.购买商品:购买商品需要先选择分类,然后再进入商品详情,详情包括商品名称,价格,库存,需要流程为商品分类--》商品详情--》商品编号--》商品数量--》商品购物车
  23. 6.商品库存:购买时入超过库存回提示购买失败,加入购物车时也会对库存做相应的修改
  24. 7.购物车:购物车可显示购买商品的详情,包括名称,商品数量以及总价,如果需要修改购物车,需要返回主菜单编辑购物车
  25. 8.编辑购物车:可编辑商品的购买数量,选择对应的编号,然后输入数量,如果想不想要商品,直接在选择数量时输入0即可
  26. 9.购物历史:主菜单可选择显示购物历史,会显示每个时间段的购物详情
  27. 10.最后的最后:输入无用的字符会提示输入错误并返回选择页面

流程图:

user_info:

  1. {
  2. "": [
  3. "",
  4. 0,
  5. []
  6. ],
  7. "shane": [
  8. "",
  9. 100003,
  10. []
  11. ],
  12. "zc": [
  13. "",
  14. 0,
  15. []
  16. ],
  17. "cc": [
  18. "",
  19. 1626,
  20. [
  21. [
  22. "2016-05-19 14:23:37",
  23. [
  24. [
  25. "小白鞋",
  26. 1,
  27. 900
  28. ],
  29. [
  30. "T恤",
  31. 1,
  32. 300
  33. ]
  34. ]
  35. ],
  36. [
  37. "2016-05-19 17:07:06",
  38. [
  39. [
  40. "微波炉",
  41. 1,
  42. 800
  43. ]
  44. ]
  45. ],
  46. [
  47. "2016-05-19 17:56:19",
  48. [
  49. [
  50. "Nudie牛仔裤",
  51. 1,
  52. 699
  53. ],
  54. [
  55. "洗衣机",
  56. 1,
  57. 999
  58. ]
  59. ]
  60. ],
  61. [
  62. "2016-05-20 10:07:34",
  63. [
  64. [
  65. "IBM X240",
  66. 1,
  67. 6999
  68. ]
  69. ]
  70. ]
  71. ]
  72. ],
  73. "chengc": [
  74. "",
  75. 999999999,
  76. []
  77. ],
  78. "zhangxiaodong": [
  79. "zhangxiaodong",
  80. 0,
  81. []
  82. ]
  83. }

goods_info:

  1. {
  2. "家电": {
  3. "微波炉": {
  4. "price": 800,
  5. "belong": "家电",
  6. "stock": 2995
  7. },
  8. "热水器": {
  9. "price": 600,
  10. "belong": "家电",
  11. "stock": 900
  12. },
  13. "洗衣机": {
  14. "price": 999,
  15. "belong": "家电",
  16. "stock": 598
  17. },
  18. "彩电": {
  19. "price": 5000,
  20. "belong": "家电",
  21. "stock": 399
  22. },
  23. "冰箱": {
  24. "price": 3000,
  25. "belong": "家电",
  26. "stock": 300
  27. }
  28. },
  29. "服装": {
  30. "Nudie牛仔裤": {
  31. "price": 699,
  32. "belong": "服装",
  33. "stock": 3978
  34. },
  35. "T恤": {
  36. "price": 300,
  37. "belong": "服装",
  38. "stock": 892
  39. },
  40. "小白鞋": {
  41. "price": 900,
  42. "belong": "服装",
  43. "stock": 5964
  44. },
  45. "驴牌腰带": {
  46. "price": 9999,
  47. "belong": "服装",
  48. "stock": 2999
  49. }
  50. },
  51. "电脑": {
  52. "IBM X240": {
  53. "price": 6999,
  54. "belong": "电脑",
  55. "stock": 3003
  56. },
  57. "Surface Book": {
  58. "price": 8999,
  59. "belong": "电脑",
  60. "stock": 3020
  61. },
  62. "Mac pro": {
  63. "price": 9999,
  64. "belong": "电脑",
  65. "stock": 3995
  66. },
  67. "Mac Air": {
  68. "price": 6999,
  69. "belong": "电脑",
  70. "stock": 6002
  71. }
  72. },
  73. "汽车": {
  74. "PASST": {
  75. "price": 299999,
  76. "belong": "汽车",
  77. "stock": 297
  78. },
  79. "BMW X3": {
  80. "price": 499999,
  81. "belong": "汽车",
  82. "stock": 399
  83. },
  84. "Tesla Model S": {
  85. "price": 799999,
  86. "belong": "汽车",
  87. "stock": 3000
  88. },
  89. "Porsche 911": {
  90. "price": 2999999,
  91. "belong": "汽车",
  92. "stock": 594
  93. }
  94. },
  95. "手机": {
  96. "XiaoMi 4": {
  97. "price": 1999,
  98. "belong": "手机",
  99. "stock": 5396
  100. },
  101. "华为Mate": {
  102. "price": 2999,
  103. "belong": "手机",
  104. "stock": 5996
  105. },
  106. "Iphone": {
  107. "price": 5888,
  108. "belong": "手机",
  109. "stock": 2998
  110. },
  111. "锤子2(这特么真是手机)": {
  112. "price": 998,
  113. "belong": "手机",
  114. "stock": 2994
  115. }
  116. }
  117. }

save_cart:

  1. {
  2. "cc": [
  3. [
  4. "锤子2(这特么真是手机)",
  5. 998,
  6. "手机"
  7. ]
  8. ],
  9. "shane": [
  10. [
  11. "微波炉",
  12. 800,
  13. "家电"
  14. ],
  15. [
  16. "微波炉",
  17. 800,
  18. "家电"
  19. ],
  20. [
  21. "洗衣机",
  22. 999,
  23. "家电"
  24. ]
  25. ]
  26. }

user_lock:

  1. 123

程序代码:

  1. #!/usr/bin/env python
  2. # -*-coding=utf-8-*-
  3. # Auther:ccorz Mail:ccniubi@163.com Blog:http://www.cnblogs.com/ccorz/
  4. # GitHub:https://github.com/ccorzorz
  5.  
  6. import json,prettytable,time,collections
  7. user_info=json.load(open('user_info','r'))
  8. goods=json.load(open('goods_info','r'))
  9. save_cart=json.load(open('save_cart','r'))
  10. time_now=time.strftime('%Y-%m-%d %H:%M:%S')
  11.  
  12. def refresh_goods():
  13. json.dump(goods,open('goods_info','w'),ensure_ascii=False,indent=1)
  14.  
  15. def refresh_user():
  16. json.dump(user_info,open('user_info','w'),ensure_ascii=False,indent=1)
  17.  
  18. def cache_cart(user_name):
  19. save_cart[user_name]=cart
  20. # print('save_cart[user_name]',save_cart[user_name])
  21. json.dump(save_cart,open('save_cart','w'),ensure_ascii=False,indent=1)
  22.  
  23. def regis():
  24. exit_flag=0
  25. while exit_flag==0:
  26. user_name=input('请输入您的用户名:')
  27. if user_name in user_info.keys():
  28. print('此用户已被注册,请重新输入.')
  29. else:
  30. user_pwd=input('请输入您的密码:')
  31. for i in range(3):
  32. user_pwd_again=input('请再次确认您的密码:')
  33. if user_pwd_again==user_pwd:
  34. user_info[user_name]=[user_pwd_again,0,[]]
  35. refresh_user()
  36. print('用户名%s已注册成功,请登录购买商品...'%user_name)
  37. exit_flag=1
  38. break
  39. elif i==2:
  40. print('您输入的密码次数超过三次,注册关闭!')
  41. exit_flag=1
  42. else:
  43. print('您输入的密码和上次输入的密码不匹配,请重新输入,还有%s次机会.'%(2-i))
  44. def refill(user_name):
  45. for i in range(3):
  46. amount=input('请输入您要充值的金额,请输入数字:')
  47. if amount.isdigit():
  48. user_info[user_name][1]+=int(amount)
  49. refresh_user()
  50. print('\033[32;1m土豪,请保养程序员!!!\033[0m充值成功,您的余额为\033[31;1m%s\033[0m'%user_info[user_name][1])
  51. balance=user_info[user_name][1]
  52. print(balance)
  53. break
  54. elif i==2:
  55. exit('你在坑我么?告诉你要输入数字的,程序关闭...')
  56. else:
  57. print('您输入的不是数字,请重新输入..')
  58.  
  59. def show_vcart(cart):
  60. # print(cart)
  61. if len(cart)>0:
  62. v_cart = collections.Counter(cart)
  63. dv_cart=dict(v_cart)
  64. row=prettytable.PrettyTable()
  65. row.field_names=['序列号','商品名称','商品数量','商品总价']
  66. for i in enumerate(dv_cart):
  67. index=i[0]
  68. item=i[1][0]
  69. totle_price = i[1][1] * dv_cart[i[1]]
  70. item_amount = dv_cart[i[1]]
  71. row.add_row([index,item,item_amount,totle_price])
  72. print(row)
  73. else:
  74. print('\033[31;1m购物车为空\033[0m'.center(50,'*'))
  75. time.sleep(1)
  76.  
  77. def check_cart():
  78. if len(cart)>0:
  79. v_cart=collections.Counter(cart)
  80. dv_cart=dict(v_cart)
  81. ddv_cart=[]
  82. for i in enumerate(dv_cart):
  83. index=i[0]
  84. item=i[1][0]
  85. totle_price = i[1][1] * dv_cart[i[1]]
  86. item_amount = dv_cart[i[1]]
  87. ddv_cart.append([item,item_amount,totle_price])
  88. user_info[user_name][2].append([time_now,ddv_cart])
  89. user_info[user_name][1]=balance
  90. refresh_user()
  91. refresh_goods()
  92. cart.clear()
  93. # print('cart:',cart)
  94. cache_cart(user_name)
  95. print('\033[31;1m结账成功,波多野结衣即将为您送货,请准备收货...\033[0m')
  96. else:
  97. print('\033[31;1m购物车是空的...\033[0m')
  98. cache_cart(user_name)
  99. time.sleep(1)
  100.  
  101. def show_his(user_name):
  102. user_info=json.load(open('user_info','r'))
  103. his_list=user_info[user_name][2]
  104. if len(his_list)==0:
  105. print('无购物历史...')
  106. else:
  107. for his in his_list:
  108. dt=his[0]
  109. print('\033[31;1m购物时间:%s\033[0m'.center(50,'*')%dt)
  110. row=prettytable.PrettyTable()
  111. row.field_names=['商品名称','数量','总额']
  112. for item in his[1]:
  113. p_name=item[0]
  114. p_amount=item[1]
  115. p_totle=item[2]
  116. row.add_row([p_name,p_amount,p_totle])
  117. print(row)
  118.  
  119. def edit_cart(user_name):
  120. e_cart=list(set(cart))
  121. e_vcart=collections.Counter(cart)
  122. e_vcart=dict(e_vcart)
  123. # print('e_vcart',e_vcart)
  124. e_cart.sort()
  125. # print('e_cart',e_cart)
  126. row=prettytable.PrettyTable()
  127. row.field_names=['商品序列号','商品名称','商品数量','总价']
  128. for i in enumerate(e_cart):
  129. index=i[0]
  130. p_name=i[1][0]
  131. p_price=i[1][1]
  132. p_amount=e_vcart[i[1]]
  133. p_totle=i[1][1]*e_vcart[i[1]]
  134. p_belong=i[1][2]
  135. # print(index,p_name,p_price,p_amount,p_totle,p_belong)
  136. row.add_row([index,p_name,p_amount,p_totle])
  137. print(row)
  138. while True:
  139. choice_num=input('请输入要编辑的商品序列号,输入q或quit为退出编辑购物车:')
  140. if choice_num.isdigit() and int(choice_num)<len(e_cart):
  141. choice_num=int(choice_num)
  142. goods_stock=goods[e_cart[choice_num][2]][e_cart[choice_num][0]]['stock']
  143. p_amount=e_vcart[e_cart[choice_num]]
  144. balance=user_info[user_name][1]
  145. print(goods_stock)
  146. while True:
  147. choice_num_d=input('输入要购买的商品数量:')
  148. if choice_num_d.isdigit():
  149. choice_num_d=int(choice_num_d)
  150. if choice_num_d<=goods_stock:
  151. if choice_num_d==p_amount:
  152. print('修改商品数量成功')
  153. break
  154. elif choice_num_d>p_amount:
  155. d_price=int(choice_num_d-p_amount)*int(e_vcart[e_cart[choice_num]])
  156. if balance>=d_price:
  157. for i in range(choice_num_d-p_amount):
  158. cart.append(e_cart[choice_num])
  159. balance-=d_price
  160. goods_stock+=p_amount
  161. goods_stock-=choice_num_d
  162. else:
  163. print('余额不足,修改失败,请充值!')
  164. break
  165. else:
  166. d_price=int(abs(choice_num_d-p_amount))*(e_vcart[e_cart[choice_num]])
  167. for i in range(abs(choice_num_d-p_amount)):
  168. cart.remove(e_cart[choice_num])
  169. balance+=d_price
  170. goods_stock+=p_amount
  171. goods_stock-=choice_num_d
  172. print('修改成功.')
  173. break
  174. else:
  175. print('输入数量有误,请合适商品的库存...')
  176. break
  177. else:
  178. print('输入类型有误请重新输入...')
  179. break
  180. elif choice_num == 'q' or choice_num == 'quit':
  181. print('退出编辑购物车...')
  182. break
  183. else:
  184. print('输入有误,请重新输入...')
  185.  
  186. break_flag=0
  187. user_lock=open('user_lock','r+')
  188. locker=user_lock.readlines()
  189.  
  190. user_name=input('请输入\033[31;1m壕\033[0m的用户名:')
  191. if user_name in locker:
  192. exit('用户已被锁定')
  193. if user_name in json.load(open('user_info','r')).keys() and user_info not in locker:
  194. for i in range(3):
  195. if break_flag==1:
  196. break
  197. else:
  198. pwd=input('请输入%s的密码:'%user_name)
  199. if pwd==user_info[user_name][0]:
  200. if save_cart.get(user_name)==None:
  201. cart=[]
  202. else:
  203. cart=save_cart[user_name]
  204. for i in range(len(cart)):
  205. cart[i]=tuple(cart[i])
  206. # print('转换后cart:',cart)
  207. print('登陆成功...')
  208. print('欢迎来到大牛逼商城,走过路过,不要错过...'.center(50,'*'))
  209. while break_flag==0:
  210. if save_cart.get(user_name)==None or len(save_cart[user_name])<=0:
  211. balance = user_info[user_name][1]
  212. print('壕,您的账户余额为:\033[31;1m%s\033[0m,\033[32;1m(钱不够?账户充值请输入r,回车继续购物)\033[0m:'%balance)
  213. else:
  214. cart_price_list=[]
  215. for i in cart:
  216. cart_price_list.append(i[1])
  217. balance=user_info[user_name][1]-sum(cart_price_list)
  218. print('\033[31;1m您的购物车中还有您上次购物时未结算的商品,如减去购物车中的商品总价,您的余额为\033[0m\033[31;1m%s\033[0m'%balance)
  219. time.sleep(1)
  220. mrow=prettytable.PrettyTable()
  221. mrow.field_names=['功能','购物','查看购物车','查看购物历史','余额充值','退出购物商城','确认购买','编辑购物车']
  222. mrow.add_row(['快捷键','回车','S或showcart','H或history','R或refill','Q或quit','C或check','E或者edit'])
  223. print(mrow)
  224. menu=input('''\033[32;1m选择菜单:\033[0m''')
  225. if menu.lower()=='r':
  226. refill(user_name)
  227. elif menu.lower()=='h' or menu.lower()=='history':
  228. time.sleep(1)
  229. show_his(user_name)
  230. time.sleep(1)
  231. elif menu.lower()=='s' or menu.lower()=='showcart' :
  232. time.sleep(1)
  233. show_vcart(cart)
  234. elif menu.lower()=='c' or menu.lower()=='check':
  235. check_cart()
  236. elif menu.lower()=='q' or menu.lower()=='quit':
  237. break_flag=1
  238. cache_cart(user_name)
  239. elif menu.lower()=='e' or menu.lower()=='edit':
  240. edit_cart(user_name)
  241. elif len(menu)==0:
  242. while break_flag==0:
  243. print('壕,您的扣除购物车中的钱款预计账户余额为:\033[31;1m%s\033[0m:'%balance)
  244. print('请选择商品的类型编号'.center(50,'='))
  245. # print(list(goods.keys()))
  246. cla_list=list(goods.keys())
  247. for i in cla_list:
  248. print(cla_list.index(i),i)
  249. choice_cla_num=input('''\033[32;1m请选择您要购买物品类型所对应的序列号(返回主菜单输入'b'或'back',查看购物车输入s,确认付款输入c,退出输入q或quit):\033[0m''')
  250. if choice_cla_num.isdigit() and int(choice_cla_num)<len(cla_list):
  251. choice_cla_num=int(choice_cla_num)
  252. cla=cla_list[choice_cla_num]
  253. goods_list=list(goods[cla])
  254. while break_flag==0:
  255. if len(cart)==0:
  256. print('壕,您的目前账户余额为:\033[31;1m%s\033[0m'%balance)
  257. else:
  258. print('壕,您购买购物车中商品后,预计账户余额为:\033[31;1m%s\033[0m'%balance)
  259. row=prettytable.PrettyTable()
  260. row.field_names=['序列号','商品名称','商品价格','商品库存']
  261. for p in goods_list:
  262. p_num=goods_list.index(p)
  263. p_name=p
  264. p_price=goods[cla][p]['price']
  265. p_stock=goods[cla][p]['stock']
  266. row.add_row([p_num,p_name,p_price,p_stock])
  267. print(row)
  268. choice_p_num=input('\033[32;1m输入您要购买的商品序列号,返回商品分类请输入b或back,查看购物车输入s,确认付款输入c,退出系统输入q或quit:\033[0m')
  269. if choice_p_num.isdigit() and int(choice_p_num)<len(goods_list):
  270. p_name=goods_list[int(choice_p_num)]
  271. p_price=goods[cla][p_name]['price']
  272. p_stock=goods[cla][p_name]['stock']
  273. p_belong=goods[cla][p_name]['belong']
  274. while break_flag==0:
  275. p_count=input('\033[32;1m输入您要购买的商品数量,直接回车系统默认数量默1:\033[0m')
  276. if len(p_count)==0:
  277. p_count=1
  278. elif p_count.isdigit():
  279. if int(p_count) <= p_stock:
  280. p_count = int(p_count)
  281. else:
  282. print('库存数量有限,最大购买数量为%s' % p_stock)
  283. break
  284.  
  285. if balance >= p_count*p_price:
  286. p_stock-=p_count
  287. goods[cla][p_name]['stock']=p_stock
  288. for i in range(p_count):
  289. cart.append((p_name,p_price,p_belong))
  290. # print(cart)
  291. print('商品\033[32;1m%s\033[0m已加入购物车'%p_name)
  292. v_cart=collections.Counter(cart)
  293. print('\033[31;1m未付款商品\033[0m'.center(50,'*'))
  294. show_vcart(v_cart)
  295. balance-=p_count*p_price
  296. break
  297. else:
  298. print('您的预计余额已不足购买\033[31;1m%s件%s\033[0m,请重新确认商品价格以及数量,也可返回主菜单编辑购物车.'%(p_count,p_name))
  299. print('\033[31;1m您可返回主菜单进入充值系统充值,8亿10亿不是事儿...\033[0m')
  300. time.sleep(1)
  301. break
  302.  
  303. elif choice_p_num.lower()=='b' or choice_p_num.lower=='back':
  304. break
  305. elif choice_p_num.lower()=='s':
  306. show_vcart(cart)
  307. elif choice_p_num.lower()=='c' or choice_p_num.lower()=='check':
  308. check_cart()
  309. elif choice_p_num.lower()=='q' or choice_p_num.lower()=='quit':
  310. break_flag=1
  311. cache_cart(user_name)
  312. else:
  313. print('输入类型错误,请重新输入')
  314. time.sleep(1)
  315. elif choice_cla_num.lower()=='s'or choice_cla_num.lower()=='showcart':
  316. show_vcart(cart)
  317. elif choice_cla_num.lower()=='c' or choice_cla_num.lower()=='check':
  318. check_cart()
  319. elif choice_cla_num.lower()=='b'or choice_cla_num.lower()=='back':
  320. break
  321. elif choice_cla_num.lower()=='q' or choice_cla_num.lower()=='quit':
  322. break_flag=1
  323. cache_cart(user_name)
  324. elif choice_cla_num.lower()=='e' or choice_cla_num.lower()=='edit':
  325. edit_cart(user_name)
  326. else:
  327. print('输入有误,请重新输入')
  328. elif i==2:
  329. user_lock.write('\n%s'%user_name)
  330. user_lock.close()
  331. exit('三次密码错误,账户已被锁定')
  332. else:
  333. print('密码错误,请重新输入...')
  334. else:
  335. y_or_n=input('没有此用户名,需要注册才能进入商城!!!是否要注册?\033[31;1m输入y或者回车为注册,n或者q退出\033[0m:')
  336. if len(y_or_n)==0 or y_or_n=='y':
  337. regis()
  338. elif y_or_n=='n' or y_or_n=='q':
  339. exit('程序退出...')
  340. else:
  341. exit('输入错误,程序退出...')

以下为运行截图:

开始运行:

购物历史记录:

选择商品分类:

商品明细:

加入购物车:

购买时余额不足:

查看购物车:

编辑购物车:

确认付款:

Day2作业:购物商城的更多相关文章

  1. day2编写购物商城(1)

    作业:购物商城 商品展示,价格 买,加入购物车 付款,钱不够     具体实现了如下功能: 1.可购买的商品信息显示 2.显示购物车内的商品信息.数量.总金额 3.购物车内的商品数量进行增加.减少和商 ...

  2. day2编写购物商城

    作业:购物商城 商品展示,价格 买,加入购物车 付款,钱不够 流程图如下: 代码共有4个文件,如下: 用户文件: alex geng zhang lou zeng 商品文件: 小米3 比亚迪宋 格力变 ...

  3. day2、购物商城

    作业:购物商城 商品展示,价格 买,加入购物车 付款,钱不够 代码如下: import codecs #登录接口,用户名密码都正确登录成功,否则失败 def login(your_name,your_ ...

  4. day5作业购物商城+ATM

    模拟实现一个ATM + 购物商城程序 1.额度 15000或自定义 2.实现购物商城,买东西加入购物车,调用信用卡接口结账 3.可以提现,手续费5% 4.每月22号出账单,每月10号为还款日,过期未还 ...

  5. day4作业模拟实现一个ATM + 购物商城程序

    作业需求: 模拟实现一个ATM + 购物商城程序 1.额度 15000或自定义: 2.实现购物商城,买东西加入 购物车,调用信用卡接口结账: 3.可以提现,手续费5%: 4.每月22号出账单,每月10 ...

  6. 老男孩Day5作业:电子银行购物商城

    1.作业需求: 模拟实现一个ATM + 购物商城程序 额度 15000或自定义 实现购物商城,买东西加入 购物车,调用信用卡接口结账 可以提现,手续费5% 支持多账户登录支持账户间转账 记录每月日常消 ...

  7. python day19 : 购物商城作业,进程与多线程

    目录 python day 19 1. 购物商城作业要求 2. 多进程 2.1 简述多进程 2.2 multiprocessing模块,创建多进程程序 2.3 if name=='main'的说明 2 ...

  8. day2 购物商城

    购物商城 商品展示.价格 买,加入购物车 付款,钱不够.(减商品,充值)

  9. Python开发程序:ATM+购物商城

    一.程序要求 模拟实现一个ATM + 购物商城程序 额度 15000或自定义 实现购物商城,买东西加入 购物车,调用信用卡接口结账 可以提现,手续费5% 每月22号出账单,每月10号为还款日,过期未还 ...

随机推荐

  1. Burp Suite的代理Brup Proxy的使用详解

    Burp Proxy 是Burp Suite以用户驱动测试流程功能的核心,通过代理模式,可以让我们拦截.查看.修改所有在客户端和服务端之间传输的数据.  

  2. Fzu-java1

    Fzu-趣考网-java1 标签(空格分隔): java 序列 题目 代码 示例 思考 题目: -制作一个Java控制台程序,让他可以随机生成四则运算,并针对用户的输入判断对错.之后在Github新建 ...

  3. Ubuntu18.04下安装Sublime Text3并解决不能输入中文

    Ubuntu18.04下安装Sublime Text3并解决不能输入中文! 废话不多说,直接按顺序执行下面命令开始安装! wget -qO - https://download.sublimetext ...

  4. 洛谷 P1082 同余方程 题解

    每日一题 day31 打卡 Analysis 题目问的是满足 ax mod b = 1 的最小正整数 x.(a,b是正整数) 但是不能暴力枚举 x,会超时. 把问题转化一下.观察 ax mod b = ...

  5. ES 基础理论 配置调优

    一.简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,并作为 ...

  6. 【CSS】div

    一.div內容溢出 .remark-div { overflow: auto; height: auto; max-height: 100px; } 1.溢出 overflow :auto时,内容超过 ...

  7. mpvue搭建小程序框架

    http://mpvue.com/mpvue/ 美团开源了mpvue 由于mpvue框架是完全基于Vue框架的(重写了其runtime和compiler) 运行时框架 runtime 和代码编译器 c ...

  8. Python3正则表达式

    正则表达式是一个特殊的字符序列,他能帮助你方便的检查一个字符串是否与某种模式匹配.   re.match函数 re.match尝试从字符串的起始位置匹配一个模式,如果不是起始位置匹配成功的话,matc ...

  9. js将数组分割成等长数组

    方法一: function group(array, subGroupLength) { let index = 0; let newArray = []; while(index < arra ...

  10. java学习笔记(1)java的基础介绍 、JDK下载、配置环境变量、运行java程序

    java工程师是开发软件的 什么是软件呢? 计算机包括两部分: 硬件: 鼠标.键盘.显示器.主机箱内部的cpu.内存条.硬盘等 软件: 软件包括:系统软件和应用软件 系统软件:直接和硬件交互的软件:w ...