qiushimm.py 文件源码

python
阅读 54 收藏 0 点赞 0 评论 0

项目:Python 作者: Guzi219 项目源码 文件源码
def SaveTotalPageToFile(self, new_page_num):

        print '====================save the totalpage to totalpage.ini===================='

        file = INIFILE('totalpage.ini')

        # must write something if you set is_write to true. otherwise your file become empty.
        is_ok = file.Init(True, True)
        if not is_ok:
            print 'class initializing failed. check the [%s] file first.' % ('totalpage.ini')
            os._exit(0)

        old_page_num = file.GetValue('Main', 'totalpage')
        print '====================the old_page_num is [%s], the new_page_num is [%s]====================' % (old_page_num, new_page_num)
        file.SetValue('Main', 'totalpage', new_page_num)
        #close all
        file.UnInit()

        if int(new_page_num) >= int(old_page_num): #if there is new page
            self.unload_page_num = int(new_page_num) - int(old_page_num)
            if self.unload_page_num == 0:   #?????????????
               self.unload_page_num = 1
            elif self.unload_page_num > 0: #??????????????????????
                self.unload_page_num += 1
            print 'Ok, we got %s pages to load.' %(self.unload_page_num)
        else: #nothing new, stop main thread
            print 'Oops! Nothing new. exit main thread now.'
            os._exit(0) #terminal sub thread
            self.enable = False #terminal main thread

    # ????????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号