发布网友
共1个回答
热心网友
bytes 函数改为 name.encode(encoding='UTF-8')追问uuid.py是python自带的库文件,怕是不能随便改吧?
追答
好吧,看错了,这里的问题是
uuid3 uuid5 这两个函数,第一个参数是一个 namespace 类型不是 str 而是一个 UUID
这里可以选择以下值中的一个,根据字符串的内容选择 NAMESPACE 下面是官方文档内容
uuid.NAMESPACE_DNS
When this namespace is specified, the name string is a fully-qualified domain
name.
uuid.NAMESPACE_URL
When this namespace is specified, the name string is a URL.
uuid.NAMESPACE_OID
When this namespace is specified, the name string is an ISO OID.
uuid.NAMESPACE_X500
When this namespace is specified, the name string is an X.500 DN in DER or a
text output format.