Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
About Lesson

decode():-

                The python string decode() method decodes the string using the codec registered for its encoding. The encoded string can be decoded and the original string can be obtained with the help of this function. This function works based on the parameters specified which are encoding and the error.

Syntax:-       Str.decode(encoding=’UTF-8′,errors=’strict’) 

str=”Hello! Welcome to akitsolution.”

str_encoded= str.encode(‘euc_kr’,’strict’)

print(“The encoded string is: “, str_encoded)

str_decoded=str_encoded.decode(‘euc_kr’, ‘strict’)

print(“The decoded string is: “, str_decoded)

Output:-

The encoded string is:  b’Hello! Welcome to akitsolution.’

The decoded string is:  Hello! Welcome to akitsolution.

error: Content is protected !!