本文主要介绍在 Python2 和 Python3 中的使用区别:
在 Python2 环境:
Python 2.7.16 (default, Mar 25 2021, 03:11:28)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
import base64
s = ‘AlwaysBeta’
a = base64.b64encode(s)
print a
QWx3YXlzQmV0YQ==