file declarationssee the currency symbols used in the money formatting example of as well as its associated file in this book' examples packageformats_currency py the latter requires source-file declaration to be usable by pythonbecause it embeds non-ascii currency symbol characters this example also illustrates the portability gains possible when using ' unicode literal in code in and later using bytes objects we studied wide variety of operations available for python ' general str string type in the basic string type works identically in and xso we won' rehash this topic insteadlet' dig bit deeper into the operation sets provided by the new bytes type in as mentioned previouslythe bytes object is sequence of small integerseach of which is in the range through that happens to print as ascii characters when displayed it supports sequence operations and most of the same methods available on str objects (and present in ' str typehoweverbytes does not support the for mat method or the formatting expressionand you cannot mix and match bytes and str type objects without explicit conversions--you generally will use all str type objects and text files for text dataand all bytes type objects and binary files for binary data method calls if you really want to see what attributes str has that bytes doesn'tyou can always check their dir built-in function results the output can also tell you something about the expression operators they support ( __mod__ and __rmod__ implement the operator) :\codec:\python \python attributes in str but not bytes set(dir('abc')set(dir( 'abc'){'isdecimal''__mod__''__rmod__''format_map''isprintable''casefold''format''isnumeric''isidentifier''encode'attributes in bytes but not str set(dir( 'abc')set(dir('abc'){'decode''fromhex'as you can seestr and bytes have almost identical functionality their unique attributes are generally methods that don' apply to the otherfor instancedecode translates raw bytes into its str representationand encode translates string into its raw bytes representation most of the methods are the samethough bytes methods require bytes arguments (again string types don' mixalso recall that bytes objects are using bytes objects