Convert Bytes to String in Python

How to convert a bytes value into string value using bytes.decode() method.

input = b'toricode.com'
output = input.decode('utf-8')

print('Input:')
print(type(input))
print(input)

print('Output:')
print(type(output))
print(output)
The output as below.
Input:
<class 'bytes'>
b'toricode.com'
Output:
<class 'str'>
toricode.com

Happy Coding 😊