怎样用command加工input信息呢

如果要用python做一个餐桌预定系统,客人input信息,包括名字、电话、预定日期和预定人数。
想用split在每个信息中间加“|”,然后记录并编码这些预订信息,可以怎么做呢?
下面蓝色是input,然后整体是想要的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

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

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')