相关疑难解决方法(0)

如何在python中将文本编码为base64

我正在尝试将文本字符串编码为base64.

我试过这样做:

name = "your name"
print('encoding %s in base64 yields = %s\n'%(name,name.encode('base64','strict')))
Run Code Online (Sandbox Code Playgroud)

但这给了我以下错误:

LookupError: 'base64' is not a text encoding; use codecs.encode() to handle arbitrary codecs
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?(使用Python 3.4)

python base64 encoding python-3.x

37
推荐指数
5
解决办法
8万
查看次数

标签 统计

base64 ×1

encoding ×1

python ×1

python-3.x ×1