def price(): total = [] while True: unit= input("请输入:") if unit== 'q': break else: try: total.append(int(unit)) except: print("输入数字哦") else: print("继续输入") print(total) d=price() print(d)