我的脚本包括这一行:
encoded = "Basic " + s.encode("base64").rstrip()
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 2 中工作正常,但自从切换到 3 后,我得到了错误