Python3使用md5

业务场景:爬取的文章没有id,将标题进行md5作为id使用

import hashlib

print(hashlib.new('md5', b'string').hexdigest())
# 处理中文字符
print(hashlib.md5('加密'.encode(encoding='UTF-8')).hexdigest())
复制代码

转载于:https://juejin.im/post/5d0a0fa96fb9a07ee4636748

猜你喜欢

转载自blog.csdn.net/weixin_34244102/article/details/93179232
今日推荐