这段Java代码怎么转成python代码?

byte[] req = content.getBytes("UTF-8");
String ContentMD5 = new String(Base64Utils.base64Encoding(DigestUtils.md5(req)));

Base64Utils不知道具体操作,一般是返回byte数组。为了展示方便一般会转成hex。

import hashlib
s = "abcd"
m= hashlib.md5(s.encode("utf-8"))
str = m.hexdigest()
或者
str = m.decode();

import hashlib
m = hashlib.md5(content.encode(encoding='utf-8'))
print(m.hexdigest())