擅长:python、mysql、java
<p>首先,如果我们正确解码,b64字符串和生成的GUID不匹配。在</p>
<pre><code>>>> import uuid
>>> import base64
>>> u = uuid.UUID("2243d56c-0db9-4c6c-928d-9f74ca908b7b")
>>> u
UUID('2243d56c-0db9-4c6c-928d-9f74ca908b7b')
>>> u.bytes
'"C\xd5l\r\xb9Ll\x92\x8d\x9ft\xca\x90\x8b{'
>>> base64.b64encode(u.bytes)
'IkPVbA25TGySjZ90ypCLew=='
>>> b = base64.b64decode('bNVDIrkNbEySjZ90ypCLew==')
>>> u2 = uuid.UUID(bytes=b)
>>> print u2
6cd54322-b90d-6c4c-928d-9f74ca908b7b
</code></pre>
<p>您发布的结果GUID的base64编码版本错误。我不确定我一开始不明白你对GUID的编码方式。在</p>
<p>所有的Python工具必须能够回答这个问题。不过,下面是我在python终端中所做的粗略描述:</p>
^{pr2}$
<p>这段代码应该给你足够的提示来构建你自己的函数。别忘了,pythonshell为您提供了一个强大的工具来测试和使用代码和思想。我会用笔记本之类的东西来研究。在</p>