base64.b16encode() in Python
Last Updated :
26 Mar, 2020
With the help of base64.b16encode()
method, we can encode the string by using base16 alphabet into the binary form.
Syntax : base64.b16encode(string)
Return : Return the encoded string.
Example #1 :
In this example we can see that by using base64.b16encode()
method, we are able to get the encoded string which can be in binary form by using this method.
from base64 import b16encode
s = b 'GeeksForGeeks'
gfg = b16encode(s)
print (gfg)
|
Output :
b’4765656B73466F724765656B73′
Example #2 :
from base64 import b16encode
s = b 'I love python'
gfg = b16encode(s)
print (gfg)
|
Output :
b’49206C6F766520707974686F6E’
Share your thoughts in the comments
Please Login to comment...