directoryhash是python的库。它提供了获取目标文件夹散列的机会。您可以选择将参与计算的文件类型。

directoryhash的Python项目详细描述


directoryhash是python的库。它提供了获取目标文件夹散列的机会。您可以选择将参与计算的文件类型。

Github repo

安装

使用pip安装:

pip install directoryhash

…或从github克隆项目:

https://github.com/san4ezy/directoryhash.git

如何使用?

正在获取整个目录的哈希:

from directoryhash import md5, sha1

md5_hash = md5("path_to_directory")
sha1_hash = sha1("path_to_directory")

正在获取仅包含HTML和CSS的目录的哈希:

from directoryhash import md5, sha1

filetypes = ('.html', '.css',)

md5_hash = md5("path_to_directory", filetypes)
sha1_hash = sha1("path_to_directory", filetypes)

捕捉异常:

from directoryhash import md5, HashedDirectoryDoesNotExist

directory_path = "path_to_destination_folder"
try:
    md5(directory_path)
except HashedDirectoryDoesNotExist as e:
    print(e)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android Studio:我的短信应用程序不是默认短信应用程序的选项之一   java处理字符串问题   java为什么我的程序打印“null”而不是字符串?   java为什么要创建一个无限循环?   java循环在一段时间后将布尔值更改为false?   java Android Rest Api Post 400错误请求   java调用另一个方法以获取resultset并正确关闭连接?   java我想在2d数组中添加一行   Java:我需要从outputstream中获取字节数组   C语言中Java元注释的等价物#   java如何在从web下载图像时保持原始图像的dpi?   java中基于输入值的spring boot动态值   java从请求中获取主机名   java可以复制Swing代码并在intelliJ中的designer中查看它吗   spring如何使用java配置多个ldap   安卓如何在Java中使用具有多个类似参数的JSON请求/响应循环?   java LIbGDX如何在语言更改时翻译所有文本?