in the replace call of the section "method callson page we had to pass in two bytes objects--str types won' work there although python automatically converts str to and from unicode when possible ( when the str is -bit ascii text)python requires specific string types in some contexts and expects manual conversions if neededmust pass expected types to function and method calls 'spamb replace('pa''xy'typeerrorexpected an object with the buffer interface replace( 'pa' 'xy' 'sxymb 'spamb replace(bytes('pa')bytes('xy')typeerrorstring argument without an encoding replace(bytes('pa''ascii')bytes('xy''utf- ') 'sxymmust convert manually in mixed-type expressions 'ab'cdtypeerrorcan' concat bytes to str 'abdecode('cd'abcdb'ab'cdencode( 'abcdb'abbytes('cd''ascii' 'abcdbytes to str str to bytes str to bytes although you can create bytes objects yourself to represent packed binary datathey can also be made automatically by reading files opened in binary modeas we'll see in more detail later in this firstthoughlet' introduce bytes' very closeand mutablecousin using / bytearray objects so far we've focused on str and bytesbecause they subsume python ' unicode and str python grew third string typethough--bytearraya mutable sequence of integers in the range through which is mutable variant of bytes as suchit supports the same string methods and sequence operations as bytesas well as many of the mutable in-place-change operations supported by lists unicode and byte strings