首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在python中将文本编码为base64

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

Stack Overflow用户
提问于 2014-04-19 07:44:30
回答 7查看 133.3K关注 0票数 65

我正在尝试将一个文本字符串编码为base64。

我试过这样做:

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

但这会给出以下错误:

LookupError: 'base64' is not a text encoding; use codecs.encode() to handle arbitrary codecs

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

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23164058

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档