Possible Duplicate:
Converting a string to and from Base 64如何從Base64編碼轉換爲字符串的Python 3.2
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'
請現在就更新你對你的進步,而不是發佈的內容覆蓋同樣的事情 – Sheena
在http有註釋的問題://計算器.com/questions/13261802 /轉換字符串與從基地64是正確的答案。你可以發表評論,要求澄清 – Sheena