怎么用python command记录预定信息呢?

如果要用python写一个餐桌预定系统,客人会input包括名字、电话号码、预定日期和预订人数。
我用command.split把它们分隔开,然后想记录并编码这些预订信息,可以怎么样呢?
我想要的output如下!谢谢!

img

file = input()
with open(file,'r') as f:
    lines = f.readlines()
    nums = len([line for line in lines if len(line.strip())==2])
    #print(f"Table file:\ntablefile.txt")
    print(f'Imported {nums} table(s)')
    f.close()
orders = {}
while True:
    order = input()
    if(order=='Exit'):
        break
    else:
        date = order.split('|')[3]
        if date in orders.keys():
            orders[date] = orders[date]+1
        else:
            orders[date] = 1
        print(f'Added booking. The ticket code for {date} is {orders[date]}')
print('Bye')

img

用xxx.split('|')分割输入的数据

img

s=input()
s1=s.split(' ')
print('Added '+s1[0].split('|')[0].lower()+"ing,The ticket code for "+s1[1].split('|')[2]+" is 1")

按照你的意思写了一个代码,加入了异常处理,如果输入格式不对会提醒

count = 0
code = 0
path = input("Table file\n")
with open(path, 'r') as f:
    for one in f.readlines:
        if int(one.strip()) >= 10:
            count += 1
print("Imported {} table(s)".format(count))

while True:
    data = input().split("|")
    if  data = 'Exit':
        break
    try:
        name = data[0]
        tel = data[1]
        date = data[3]
        num = data[4]
        code += 1
        print("Added booking. The ticket code for {} is {}".format(date, code))
    except:
        print("输入格式有误")

print('Bye')