data types "anarchists are chr( chr( 'anarchists are ascii( "'anarchists are \ \ 'if we enter on its own in idleit is output in its string formwhich for strings means the characters are output enclosed in quotes if we want only ascii characterswe can use the built-in ascii(function which returns the representational form of its argument using -bit ascii characters where possibleand using the shortest form of \xhh\uhhhhor \uhhhhhhhh escape otherwise we will see how to achieve precise control of string output later in this comparing strings str format( |strings support the usual comparison operators and >these operators compare strings byte by byte in memory unfortunatelytwo problems arise when performing comparisonssuch as when sorting lists of strings both problems afflict every programming language that uses unicode strings--neither is specific to python the first problem is that some unicode characters can be represented by two or more different byte sequences for examplethe character (unicode code point can be represented in utf- encoded bytes in three different ways[ xe xab][ xc ]and [ xcc afortunatelywe can solve this problem if we import the unicodedata module and call unicodedata normalize(with "nfkcas the first argument (this is normalization method--three others are also available"nfc""nfd"and "nfkd")and string containing the character using any of its valid byte sequencesthe function will return string that when represented as utf- encoded bytes will always be the byte sequence [ xc the second problem is that the sorting of some characters is language-specific one example is that in swedish is sorted after zwhereas in germana is sorted as if though were spelled ae another example is that although in english we sort as if it were oin danish and norwegian it is sorted after there are lots of problems along these linesand they can be complicated by the fact that sometimes the same application is used by people of different nationalities (who therefore expect different sorting orders)and sometimes strings are in mixture of languages ( some spanishothers english)and some characters (such as arrowsdingbatsand mathematical symbolsdon' really have meaningful sort positions as matter of policy--to prevent subtle mistakes--python does not make guesses in the case of string comparisonsit compares using the stringsinmemory byte representation this gives sort order based on unicode code character encodings