can' mix in if str is non-asciiu ' \xc \xe cs unicodedecodeerror'asciicodec can' decode byte xc in position ordinal not in range( 'abcu 'abca\xc \xe cprint 'abcu abcaabec can mix only if str is all -bit ascii decode('latin- ' ' \xc \xe ca\xc \xe cprint decode('latin- ' aabecaabec manual conversion may be required in too print '\xa ' ps also see ' currency example use print to display characters by contrastin xstr and bytes never mix automatically and require manual conversions--the preceding code actually runs in but only because ' unicode literal is taken to be the same as normal string by (the is ignored)the equivalent would be str added to bytes ( 'abb'cd'which fails in xunless objects are converted to common type in xthoughthe difference in types is often trivial to your code like normal stringsunicode strings may be concatenatedindexedslicedmatched with the re moduleand so onand they cannot be changed in place if you ever need to convert between the two types explicitlyyou can use the built-in str and unicode functions as shown earlierstr( 'spam''spamunicode('spam' 'spamunicode to normal normal to unicode if you are using python xalso watch for an example of your different file interface later in this your open call supports only files of -bit bytesreturning their contents as str stringsand it' up to you to interpret the contents as text or binary data and decode if needed to read and write unicode files and encode or decode their content automaticallyuse ' codecs open call we'll see in action later in this this call provides much the same functionality as ' open and uses unicode objects to represent file content--reading file translates encoded bytes into decoded unicode charactersand writing translates strings to the desired encoding specified when the file is opened source file character set encoding declarations finallyunicode escape codes are fine for the occasional unicode character in string literalsbut they can become tedious if you need to embed non-ascii text in your coding unicode strings