프로그래밍언어/Python
string to base64
부산딸랑이
2014. 10. 28. 00:13
text = '하이'.encode('utf8')
encoded = base64.b64encode (text)
#base64 인코딩 ascii문자열은 바로 사용가능
#encoded = base64.b64encode(b'data to be encoded')
파이썬2
>>> b = base64.encodestring(b'하이')
>>> s = base64.decodestring(b)
>>> print urllib.unquote(s)