欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

利用python計算windows全盤文件md5值的腳本

系統 1870 0
            
import hashlib
import os
import time
import configparser
import uuid
 
def test_file_md5(file_path):
  test = hashlib.md5()
 
  if os.path.isfile(file_path):
    with open(file_path, "rb") as f:
      while True:
        data = f.read(8096)
        if not data:
          break
        else:
          test.update(data)
      ret = test.hexdigest()
      config = configparser.ConfigParser()
 
      config.read("E:/python/pycharm/再開次開始/前端/test_md5.ini",encoding="utf-8")
      if config.has_section(os.path.basename(file_path)):
        new_section_name = str(os.path.basename(file_path)) + ":" + str(uuid.uuid4())
        config[new_section_name] = {"文件路徑":os.path.dirname(file_path),
                 "md5值":ret}
      else:
        config[os.path.basename(file_path)] = {"文件路徑": os.path.dirname(file_path),
                        "md5值": ret}
      config.write(open("E:/python/pycharm/再開次開始/前端/test_md5.ini","w",encoding="utf-8"))
 
 
 
def test_dir_md5(file_path):
  test_abs_path = os.path.abspath(file_path)
  # print(test_abs_path)
  os.chdir(test_abs_path)
  for file in os.listdir(os.getcwd()):
    if os.path.isfile(file):
      test_file_md5(os.path.abspath(file))
    elif os.path.isdir(file):
      test_dir_md5(os.path.abspath(file))
    else:
      pass
  # return True
 
 
if __name__ == '__main__':
  began_path = os.getcwd()
  test_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(began_path))))
  os.chdir(test_path)
  print(os.listdir())
  for test_file in os.listdir():
    os.chdir(test_path)
    if os.path.abspath(test_file).startswith("E:\\$"):
      continue
    else:
      if os.path.isfile(test_file):
        # print("yyyyy")
        test_file_md5(os.path.abspath(test_file))
      elif os.path.isdir(test_file):
        # print("hahah")
        test_dir_md5(os.path.abspath(test_file))
        # print(os.path.abspath(test_file))
      else:
        pass
          

結果如下

利用python計算windows全盤文件md5值的腳本_第1張圖片

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 99草在线观看 | 国产亚洲欧美在线 | 99久久99久久免费精品蜜桃 | 国产专区视频 | 九九精品视频在线 | 午夜在线观看视频 | 91亚洲国产精品 | 日韩精品在线播放 | 色综合99| 亚洲高清久久 | 亚洲网站在线观看 | 亚洲成人av一区二区 | 欧美一级毛片一 | 国产无线乱码一区二三区 | 亚洲欧洲日产国码在线观看 | 91蝌蚪九色 | 五月婷婷六月丁香 | 久久宗合色 | 久草在线免费福利视频 | av色在线| 亚洲成人免费 | 国产福利资源在线 | 欧美精品久久久久久久久老牛影院 | 久久精品视频99 | 一级片一级片一级片一级片 | 亚洲三区在线观看 | 九九精品视频一区在线 | 国产精品免费视频网站 | 午夜视频十八嗯嗯啊免费 | 在线观看91精品国产入口 | 黄色视频a级毛片 | 婷婷的久久五月综合先锋影音 | 国产日产亚洲欧美综合另类 | 久草2018| 久久免费视频一区 | 久草福利在线视频 | 成人免费毛片高清视频 | 成人一区二区在线 | 亚洲婷婷综合中文字幕第一页 | 一区二区三区中文字幕 | 青青99|