Possible Duplicate:
Converting a string to and from Base 64
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'