7.  bytes data type:

  • Bytes data type represents a group of byte numbers.
  • byte() converts an object to immutable byte represented object of given size and data.
  • For binary representation, we use the bytes data type.
  • Ex: audio, video processing, and image, etc.

Syntax:   Syntax : bytes(src, enc, err)


  • Source(optional): The source object which has to be converted
  • encoding(optional): The encoding required in case an object is a string
  • errors(optional): Way to handle error in case the string conversion fails.
  • In bytes data type every value should be in the range of 0 to 256 only.
  • Bytes data type is immutable (cannot be modified).