codecs.encode() in Python Last Updated : 26 Mar, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of codecs.encode() method, we can encode the string into the binary form . Syntax : codecs.encode(string) Return : Return the encoded string. Example #1 : In this example we can see that by using codecs.encode() method, we are able to get the encoded string which can be in binary form by using this method. Python3 1=1 # import codecs import codecs s = 'GeeksForGeeks' # Using codecs.encode() method gfg = codecs.encode(s) print(gfg) Output : b'GeeksForGeeks' Example #2 : Python3 1=1 # import codecs import codecs s = 'I love python.' # Using codecs.encode() method gfg = codecs.encode(s) print(gfg) Output : b'I love python.' Comment More infoAdvertise with us Next Article Python program to convert binary to ASCII J jitender_1998 Follow Improve Article Tags : Python Python Programs Python codecs-module Practice Tags : python Similar Reads Python | Encoding Decoding using Matrix This article is about how we use the matrix to encode and decode a text message and simple strings. Encoding process : Take a String convert to corresponding number shown below convert to 2D matrix(array). Now we have 2x2 matrix! When we multiply this matrix with encoding matrix we get encoded 2x2 m 4 min read Python - Golomb Encoding for b=2n and b!=2n The Golomb coding is a form of parameterized coding in which integers to be coded are stored as values relative to a constant b Coding:- A positive number x is spoken to in two sections: The initial segment is an unary portrayal of q+1, where q is the remainder floor((x/b)), andThe subsequent part i 3 min read Convert String to bytes-Python The goal here is to convert a string into bytes in Python. This is essential for working with binary data or when encoding strings for storage or transmission. For example, given the string "Hello", these methods can convert it into a byte representation like b'Hello'. Letâs explore different method 2 min read hashlib.sha3_256() in Python With the help of hashlib.sha3_256() method, we can convert the normal string in byte format is converted to an encrypted form. Passwords and important files can be converted into hash to protect them with the help of hashlib.sha3_256() method. Syntax : hashlib.sha3_256() Return : Return the hash cod 1 min read Python program to convert binary to ASCII In this article, we are going to see the conversion of Binary to ASCII in the Python programming language. There are multiple approaches by which this conversion can be performed that are illustrated below: Method 1: By using binascii module Binascii helps convert between binary and various ASCII-en 3 min read Python program to convert ASCII to Binary We are having a string s="Hello" we need to convert the string to its ASCII then convert the ASCII to Binary representation so that the output becomes : 01001000 01100101 01101100 01101100 0110111. To convert an ASCII string to binary we use ord() to get the ASCII value of each character and format( 2 min read Like