Bytes literals in Python

In Byte Literal we used to produce a new object each time it is evaluated which is like and unlike string beacuse bytes literal, like lists and unlike strings are mutable.

Bytes Literal is similar to string literal with the addition of a 'b' prefix.

It is a single ASCII character (in the U+0000 to U+007F range) or a single escape preceded by the characters U+0062 ( b ) and U+0027 (single-quote), and followed by the character U+0027.

Example:

x= b'abc'
x.decode("utf-8") 
'abc'

Output: 'abc'

Tags