are written to filethe raw bytes shown here for encoding results are what is actually stored on the file for the encoding types givens encode('latin- ' '\xc \xe byte per character when encoded encode('utf- ' '\xc \ \xc \xa bytes per character when encoded len( encode('latin- ') len( encode('utf- ') bytes in latin- in utf- note that you can also go the other wayreading raw bytes from file and decoding them back to unicode string howeveras we'll see laterthe encoding mode you give to the open call causes this decoding to be done for you automatically on input (and avoids issues that may arise from reading partial character sequences when reading by blocks of bytes) '\xc \xe '\xc \xe len( decode('latin- ''aeb '\xc \ \xc \xa len( decode('utf- ''aelen( decode('utf- ') text encoded per latin- raw bytestwo encoded characters decode to text per latin- text encoded per utf- raw bytestwo encoded characters decode to text per utf- two unicode characters in memory other encoding schemes some encodings use even larger byte sequences to represent characters when neededyou can specify both and -bit unicode code point values for characters in your strings--as shown earlierwe can use "\ with four hex digits for the formerand "\ with eight hex digits for the latterand can mix these in literals with simpler ascii characters freelys ' \ \ cs 'aabeclen( abcand non-ascii characters five characters long encode('latin- ' ' \xc \xe ccoding unicode strings