検索
ホームページバックエンド開発Python チュートリアルpython批量同步web服务器代码核心程序

#!/usr/bin/env python 
#coding:utf8 
import os,sys import md5,tab from mysql_co.my_db import set_mysql from ssh_co.ssh_connect import sshd from ssh_co.cfg.config import ssh_message,item_path from file import findfile def my_mysql(): 
  db_file={} 
  my_connect=set_mysql() 
  f_file=findfile.main(item_path) 
  list_file=findfile.file_list(f_file) 
  see_file=my_connect.display_db() 
  for knumber,kname,ksgin,ksize,katime,kmtime in see_file: 
    db_file[kname]=[ksgin,ksize,katime,kmtime] 
  for fname,fsize,fatime,fmtime in list_file: 
      if fname in db_file.keys(): 
        if ("%f")%fmtime == ("%f")%db_file[fname][3]: 
          print "%s The same mtime pass"%fname 
          my_connect.set_file_attribute(10,fname,fmtime) 
          pass
        else: 
          print "%s different for mtime"%fname 
          my_connect.set_file_attribute(11,fname,fmtime) 
      else: 
        my_connect.add_db(fname,fsize,fatime,fmtime) 
        my_connect.set_file_attribute(11,fname,fmtime) 
        print "%s,is new file"%fname 
  new_file=my_connect.new_db() 
  my_connect.disconn_db() 
  return new_file def my_ssh(new_file): 
  pid_host = 1
  for host_attribute in ssh_message: 
    ssh_conn=sshd(host_attribute,pid_host) 
    for file_name in new_file: 
      if file_name: 
        a=ssh_conn.put_ssh_file(file_name[1]) 
        print a 
        print "ssh_connect memoryID: %s" %pid_host 
      else: 
        pid_host = id(host_attribute) 
        ssh_conn.disconn_ssh() def main(): 
  new_file=my_mysql() 
  my_ssh(new_file) 
 if __name__ == "__main__": 
  main()

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
Python:編集と解釈に深く掘り下げますPython:編集と解釈に深く掘り下げますMay 12, 2025 am 12:14 AM

pythonusesahybridmodelofcompilation andtertation:1)thepythoninterpretercompilessourcodeodeplatform-indopent bytecode.2)thepythonvirtualmachine(pvm)thenexecuteTesthisbytecode、balancingeaseoputhswithporformance。

Pythonは解釈されたものですか、それとも編集された言語であり、なぜそれが重要なのですか?Pythonは解釈されたものですか、それとも編集された言語であり、なぜそれが重要なのですか?May 12, 2025 am 12:09 AM

pythonisbothintersedand compiled.1)it'scompiledtobytecode forportabalityacrossplatforms.2)bytecodeisthenは解釈され、開発を許可します。

ループ対pythonのループの場合:説明されたキーの違いループ対pythonのループの場合:説明されたキーの違いMay 12, 2025 am 12:08 AM

loopsareideal whenyouwhenyouknumberofiterationsinadvance、foreleloopsarebetterforsituationsは、loopsaremoreedilaConditionismetを使用します

ループのために:実用的なガイドループのために:実用的なガイドMay 12, 2025 am 12:07 AM

henthenumber ofiterationsisknown advanceの場合、dopendonacondition.1)forloopsareideal foriterating over for -for -for -saredaverseversives likelistorarrays.2)whileopsaresupasiable forsaresutable forscenarioswheretheloopcontinupcontinuspificcond

Python:それは本当に解釈されていますか?神話を暴くPython:それは本当に解釈されていますか?神話を暴くMay 12, 2025 am 12:05 AM

pythonisnotpurelyLepted; itusesahybridapproachofbytecodecodecodecodecodecodedruntimerttation.1)pythoncompilessourcodeintobytecode、whodythepythonvirtualmachine(pvm).2)

同じ要素を持つPython Concatenateリスト同じ要素を持つPython ConcatenateリストMay 11, 2025 am 12:08 AM

ToconcatenateListsinpythothesheElements、使用:1)Operatortokeepduplicates、2)asettoremoveduplicates、or3)listcomplunting for controloverduplicates、各メトドハスディフェルフェルフェントパフォーマンスアンドソーダーインプリテーション。

解釈対編集言語:Pythonの場所解釈対編集言語:Pythonの場所May 11, 2025 am 12:07 AM

pythonisantertedlanguage、useaseofuseandflexibility-butfactingporformantationationsincriticalapplications.1)解釈されたlikepythonexecuteline-by-lineを解釈します

ループのために:Pythonでそれぞれを使用するのはいつですか?ループのために:Pythonでそれぞれを使用するのはいつですか?May 11, 2025 am 12:05 AM

Useforloopswhenthenumberofiterationsisknowninadvance、andwhiloopswheniterationsdependonacondition.1)forloopsareidealforsecenceslikelistoranges.2)

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

Dreamweaver Mac版

Dreamweaver Mac版

ビジュアル Web 開発ツール

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!