类属性实现翻页

# -*-coding:utf-8 -*-
__author__ = 'xiaojiaxin'
__file_name__ = 'test'

#利用属性实现分页

class pagesperation:

    def __init__(self,p):
        try:
            self.p=int(p)
        except Exception as e:
            p=1

    @property
    def start(self):
        start=(self.p-1)*10
        return start

    @property
    def end(self):
        end=self.p*10
        return end

li=[ ]
for i in range(1,1000):
    li.append(i)

while True:
    show_page=input("输出页码:")
    obj=pagesperation(show_page)

    #1 1-10
    #2 11-20
    #3 21-30

    print(li[obj.start:obj.end])