import base64
copyright = 'Copyright (c) 2012 Doucube Inc. All rights reserved.'
def main():
#转成bytes string
bytesString = copyright.encode(encoding="utf-8")
print(bytesString)
#base64 编码
encodestr = base64.b64encode(bytesString)
print(encodestr)
print(encodestr.decode())
#解码
decodestr = base64.b64decode(encodestr)
print(decodestr.decode())
if __name__ == '__main__':
main()
Python全栈•基础(一)⁃Python3 base64算法加密解密
最新推荐文章于 2024-07-12 18:40:37 发布