Base64.encode字符串在python中不起作用,输入错误:内存视图:需要像对象一样的字节

时间:2018-06-01 06:12:57

标签: python anaconda

我试图在python中获得实时流式传输我在这一行找到了错误,我已经尝试了所有可能的解决方案在互联网和堆栈溢出但我的代码没有解决,我使用的是Anaconda Prompt-Python 3.6。 4

auth_encoded = base64.encodestring('%s:%s' % (user, password))[:-1]

我也试过

  • auth_encoded = base64.b64encode(base64.b64decode('%s:%s'%(用户, 密码)))

  • auth_encoded = base64.b64encode(bytes('%s:%s'%(用户,密码)))

  • auth_s = urllib.parse.unquote(('%s:%s'%(用户,密码)))
       auth_bytes = auth_s.encode()
       encoded_bytes = base64.encodestring(auth_bytes)

Error Screenshot

0 个答案:

没有答案