Using Python for paging operations

Source: Internet
Author: User

Class GetPage:
"" To get the start and end points "" From this class
def __init__ (self,page):
Try
self.page = Int (page)
Except Exception as E:
Self.page = 1
@property
def start (self):
Start_page = (self.page-1) * 10
return Start_page
def end (self):
End_page = Self.page * 10
Return End_page
End = Property (Fget=end) # is the same as @property effect directly above. There are fget,fset,fdel functions in them. This is how the post section of the Django source is played.

Pages_list=[]
For NUM in range (100):
Pages_list.append (num)
While True:
Page=input ("Please enter the page number you want to see:")
Obj=getpage (page)
Print (Pages_list[obj.start:obj.end])


Using Python for paging operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.