Saturday, January 31, 2026
HomeLanguagesbase64.encodebytes(s) in Python

base64.encodebytes(s) in Python

With the help of base64.encodebytes(s) method, we can encode the string using base64 encoded data into the binary form.

Syntax : base64.encodebytes(string)

Return : Return the encoded string.

Example #1 :
In this example we can see that by using base64.encodebytes(s) method, we are able to get the encoded string which can be in binary form by using this method.




# import base64
from base64 import encodebytes
  
s = b'GeeksForGeeks'
# Using base64.encodebytes(s) method
gfg = encodebytes(s)
  
print(gfg)


Output :

b’R2Vla3NGb3JHZWVrcw==\n’

Example #2 :




# import base64
from base64 import encodebytes
  
s = b'I love python'
# Using base64.encodebytes(s) method
gfg = encodebytes(s)
  
print(gfg)


Output :

b’SSBsb3ZlIHB5dGhvbg==\n’

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

1 COMMENT

Most Popular

Dominic
32478 POSTS0 COMMENTS
Milvus
122 POSTS0 COMMENTS
Nango Kala
6849 POSTS0 COMMENTS
Nicole Veronica
11978 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12066 POSTS0 COMMENTS
Shaida Kate Naidoo
6987 POSTS0 COMMENTS
Ted Musemwa
7222 POSTS0 COMMENTS
Thapelo Manthata
6934 POSTS0 COMMENTS
Umr Jansen
6917 POSTS0 COMMENTS