2024-04-19 17:54:30 发布
网友
我正在尝试连接两个编码为base64的字符串,但它实际上不起作用,只打印concatation中的第一个字符串:
q = base64.b64encode("StringA") print q # prints an encoded string q = q+base64.b64encode("StringB") print q # prints an encoded string print base64.b64decode(q) # just prints "StringA"
您正在解码由两个base64字符串串联而成的字符串。这是不对的。你应该这样做-
base64.b64decode(base64.b64encode("StringA" + "StringB"))
这是有效的:
>>> ''.join([base64.b64encode("StringA"), base64.b64encode("StringB")]) 'U3RyaW5nQQ==U3RyaW5nQg=='
您正在解码由两个base64字符串串联而成的字符串。这是不对的。你应该这样做-
这是有效的:
相关问题 更多 >
编程相关推荐