func.py 336 Bytes Edit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 def func(): total = [] while True: unit= input("请输入:") if unit== 'q': break else: try: unit1=int(unit) except: print("请输入整数") else: total.append(unit1) return total print(func())