【发布时间】:2012-11-07 01:44:55
【问题描述】:
def convertFromBase64 (stringToBeDecoded):
import base64
decodedstring=str.decode('base64',"stringToBeDecoded")
print(decodedstring)
return
convertFromBase64(dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE=)
我想要获取一个 base64 编码的字符串并将其转换回原始字符串,但我不知道出了什么问题
我收到了这个错误
Traceback (most recent call last):
File "C:/Python32/junk", line 6, in <module>
convertFromBase64(("dGhpcyBpcyBzdHJpbmcgZXhhbXBsZS4uLi53b3chISE="))
File "C:/Python32/junk", line 3, in convertFromBase64
decodedstring=str.decode('base64',"stringToBeDecoded")
AttributeError: type object 'str' has no attribute 'decode'
【问题讨论】:
-
请现在用你的进度更新你的问题,而不是发布涵盖相同内容的内容
-
您在stackoverflow.com/questions/13261802/… 上得到的评论是正确答案。你本可以发表评论要求澄清
标签: python-3.x base64