import time
import datetime
# # 创建shop_goods.txt文件用于存放商品信息
# with open('shop_goods.txt', 'w') as goods_flie:
# pass
# # 创建consumption_records.txt文件用于存放用户的购买记录
# with open('consumption_records.txt', 'w') as cmr_flie:
# pass
# # 创建daily_sale.txt文件用来存放每日销售情况
# with open('daily_sale.txt', 'w') as ds_file:
# pass
dict = {} # 用来存放顾客消费记录
total = 0 # 存放总金额
dict_save = {} # 统计当日销售情况
def showGoods():
with open('shop_goods.txt', 'r', encoding='utf-8') as rstream:
goodsFile = rstream.read()
if len(goodsFile) == 0:
print('请先添加商品!')
else:
print('商品信息如下!')
str = '%s\t%s\t%s\t%s' % ('编号', '名称', '单价', '数量')
print(str)
print("*" * 30)
print(goodsFile)
print('*' * 30)
def addGoods():
id = input('请输入商品编号:')
name = input('请输入商品名称:')
goods_save = []
with open('shop_goods.txt', 'r', encoding='utf-8') as rstream:
while True:
goodsFile = rstream.readlines()
if not good