每天CookBook之Python-103

  • BASE64的编码和解码

s = b'hello'

import base64

a = base64.b64encode(s)

print(a)
print(base64.b64decode(a))

a = base64.b64encode(s).decode('ascii')

print(a)
b'aGVsbG8='
b'hello'
aGVsbG8=
posted @ 2016-07-29 21:53  4Thing  阅读(94)  评论(0编辑  收藏  举报