base64.encodestring(s) in Python
Last Updated :
22 Apr, 2020
With the help of base64.encodestring(s)
method, we can encode the string using base64 encoded data into the binary form.
Syntax : base64.encodestring(string)
Return : Return the encoded string.
Example #1 :
In this example we can see that by using base64.encodestring(s)
method, we are able to get the encoded string which can be in binary form by using this method.
from base64 import encodestring
s = b 'GeeksForGeeks'
gfg = encodestring(s)
print (gfg)
|
Output :
b’R2Vla3NGb3JHZWVrcw==\n’
Example #2 :
from base64 import encodestring
s = b 'I love python'
gfg = encodestring(s)
print (gfg)
|
Output :
b’SSBsb3ZlIHB5dGhvbg==\n’
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...