0%

Python用Base64编码文件

编码

1
2
3
4
5
import base64

bytes = b"wudinaonao"
base64.b64encode(bytes)

输出

1
'd3VkaW5hb25hbw=='

解码

1
2
3
4
5
6
import base64

bytes = b"wudinaonao"
encode = base64.b64encode(bytes)
base64.b64decode(encode, "utf-8")

输出

1
'wudinaonao'