2

So I am confused about what it actually means to encode a string into bytes.

I obviously understand that everything in a computer is represented by a sequence of 1's and 0's and eight of those together is one byte. So I am getting confused by the encoding operation on strings. For example, in Python, you write a string or you can write a bytes version of the string like so.

'foo' # usual string
b'foo' # bytes version of the string

How do these actually differ in memory if both still need to be represented by a sequence of 1's and 0's?

under_the_sea_salad
  • 1,754
  • 3
  • 22
  • 42

0 Answers0