<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ```python #!/usr/bin/python3 # coding=gbk ''' Note: 獲取文件的改變 Author:redsun Data:2019/7/10 ''' import os import time import urllib3 def GetFileEndChange(File_Path): ''' 從文件尾部開始檢查文件追加的內容 :param File_Path: 路徑 :return: 輸出尾部增加的內容 ''' if os.path.isfile(File_Path): with open(File_Path, encoding='gbk') as f: f.seek(0, 2) cur = f.tell() temp = 0 text = '' HelpInfoHead('Change', File_Path, cur) var = 1 firstdatacheck = '' # 改寫的代碼STATR while var == 1: # while True: f.seek(cur) ch = f.readlines() CheckFile() #監控文件檢測是否存在 # 如果沒有讀到數據,跳出循環 if not ch: # if HelpInfoChangeEnd('Change',temp) == 'no': HelpInfoChangeEnd('Change', temp) if 1 == 1: print('監控中...') time.sleep(3) # break else: print(123) else: for line in ch: text = line print(text) print('查看每次的值'+firstdatacheck) # firstdatacheck=tuidata(text, firstdatacheck) # 執行每條的推送判斷開始 # 按照規范處理text 26;20200810;0.091011;TA;多頭開倉;手數=5;開倉價格=3772.8;Service_str1;20200810;0.091 tt = text.split(';') if not firstdatacheck is None: if tt[0] != firstdatacheck: firstdatacheck = tt[0] # 賦值 # print('執行第二條件') print('當前的firstdatacheck值' + firstdatacheck) if tt[1] == tt[8]: sec = abs(float(tt[2]) - float(tt[9])) print('執行秒的差值1' + str(sec)) if sec < 0.0015: print('執行推送1') pushdata(text) else: print('不推送3-時間大于15分鐘') else: print('不推送2-年月日不同11') else: print('不推送1-第一個參數沒變') else: firstdatacheck = tt[0] # 賦值 if tt[1] == tt[8]: sec = abs(float(tt[2]) - float(tt[9])) if sec < 0.0015: print('執行推送2') pushdata(text) else: print('不推送33-時間大于15分鐘') else: print('不推送22-年月日不同') HelpInfoContent(text, temp) # 執行每條的推送判斷開始 temp += 1 cur = f.tell() # 改寫的代碼END else: print('文件'+File_Path+'不存在') time.sleep(3) # GetFileEndChange(docname()) GetFileEndChange('Service.log'); def CheckFile(): if os.path.isfile('Service.log'): print('文件存在繼續健康執行....') else: print('文件Service.log不存在') time.sleep(3) GetFileEndChange('Service.log'); # 推送消息 def pushdata(text): print('**********************************************************************') print(text) print('**********************************************************************') http = urllib3.PoolManager() url = 'http://www.test.com/api/User/push?data='+text http.request('GET', url) print('發送成功') def HelpInfoChangeEnd(FuctionName,times=-1): ''' 提示信息——尾部 :return: no 結束 yes 繼續 ''' if times == 0: raw = 1 elif times == -1 : raw = 'no' else: print('Check {times} times. '.format(times=times)) raw = 'yes' print('No {FuctionName} in {clock}'.format(FuctionName= FuctionName, clock = GetTime()) ) if raw == 'no' or raw == 'NO': print('check finish !') print('----------------------------------------------------------') sign = 'no' else: sign = 'yes' return sign def HelpInfoHead(FuctionName, File_Path, bits = -1): ''' 提示信息——頭部 :param FuctionName:函數名 :param file_name: 文件名 :param bits: 當前文件結束地址 :return: ''' file_name = os.path.basename(File_Path) print(FuctionName) print('----------------------------------------------------------') print('Start Listen The File ({file_name}) Info ...'.format(file_name=file_name)) if bits != -1: print('The File Ends in {bits} bits . '.format(bits=bits)) print('//') def HelpInfoContent(text, times = 0): print('**********************************************************') if times != 0: print('Check {times} times. '.format(times=times)) print('Changed at {times} content: \n {text}'.format( times=GetTime(), text=text)) print('**********************************************************') def GetTime(): ''' 返回當前時間 :return: ''' return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) def docname(): return time.strftime("%Y%m%d", time.localtime(time.time()))+'_Backup.log' #GetFileEndChange(docname()) GetFileEndChange('Service.log'); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看