Avatar ·

Bytes - string translation

📁 Advanced Python Topics

  data =  .encode () # byte translation    

I can't figure out bytes... No matter how hard I try, python gives me b'hello' lines?

If you try with Cyrillic, then everything works out:

  data =  .encode ( "" UTF-8 "" ) # b '\\ xD0 \\ x9f \\ xD1 \\ x80 \\ xd0 \\ xb8 \\ xd0 \\ xb2 \\ xd0 \\ xb5 \\ xd1 \\ x82'    

Or do I have no idea about bytes? Please explain