Introduction To “Byte”

Oindrila Chakraborty
2 min readAug 10, 2023


When “Byte” is Used?

  • The “Files”, and, the “Network Resources”, such as — “HTTP Responses” are “Transmitted” as “Byte Streams”.
  • To “Read” and “Decode” such “Files”, and, “HTTP Responses” using “Python”, the “ByteData Type is used.

“Bytes” in “Python”

  • “Bytes” are “Very Similar” to the “Strings”.
  • Whereas “Strings” are the “Sequences” of “Unicode Code Points”, the “Bytes” are the “Sequences” of “Bytes”.
  • “Bytes” are “Useful” for “Raw Binary Data” and “Fixed-Width Single-Byte Character Encoding”, such as, “ASCII”.

How “Python Bytes” are “Created”?

  • “Literal Bytes” in “Python” are “Delimited” by “Quotes”.
  • Both of the “Single Quotes” and the “Double Quotes” can be used.
  • The “Quote” is “Prefixed” by a “Lowercase b”.
Create a “Literal Byte” Using “Single Quote”
Create a “Literal Byte” Using “Double Quote”

“Operations” on “Bytes”

  • “Bytes” in “Python” support “Most” of the “Same Operations” as “String”.

“Indexing” of “Bytes”

  • “Indexing” of “Bytes” “Returns” the “Integer Value” of the “Byte”, that is “Present” at the “Specified Index”.
  • In the below example, the “Integer Value” of the “Byte Character” that is “Present” in the “Third Index” of the “Byte Stream” is “110”, i.e., the “ASCII Value” of the English Lettern”.
Print the “Integer Value” of the “Third Byte”, i.e., “Index=2” from a “Sequence of Bytes”

“Splitting” of “Bytes”

  • The “Split” Operation on the “Bytes” “Returns” a “List” of “Byte Objects”.
  • The “Split” Operation is “Performed” using the “split ()” Method on the “Sequence of Bytes Object”.
“Split” a “Sequence of Bytes”



Oindrila Chakraborty

I have 11+ experience in IT industry. I love to learn about the data and work with data. I am happy to share my knowledge with all. Hope this will be of help.