面对对象的属性分页练习
class paging: def __init__(self, current_page): try: p = int(current_page) except Exception as e: p = 1 self.page = p @property def start(self): val = (self.page-1) * 10 return val @property def end(self): val = self.page * 10 return val while True: lis = [] for i in range(1000): lis.append(i) p = input("请输入页码:") obj = paging(p) print(lis[obj.start:obj.end])