bytearray-- mutable variant of bytes you generally know you are dealing with bytes if strings display or are coded with leading "bcharacter before the opening quote ( 'abc' '\xc \xe 'as we'll see in files in follow similar dichotomyusing str in text mode (which also handles unicode encodings and lineend conversionsand bytes in binary mode (which transfers bytes to and from files unchangedand in we'll see the same distinction for tools like socketswhich deal in byte strings today unicode text is used in internationalized applicationsand many of python' binaryoriented tools deal in byte strings today this includes some file tools we'll meet along the waysuch as the open calland the os listdir and os walk tools we'll study in upcoming as we'll seeeven simple directory tools sometimes have to be aware of unicode in file content and names moreovertools such as object pickling and binary data parsing are byte-oriented today later in the bookwe'll also find that unicode also pops up today in the text displayed in guisthe bytes shipped other networksinternet standard such as emailand even some persistence topics such as dbm files and shelves any interface that deals in text necessarily deals in unicode todaybecause str is unicodewhether ascii or wider once we reach the realm of the applications programming presented in this bookunicode is no longer an optional topic for most python programmers in this bookwe'll defer further coverage of unicode until we can see it in the context of application topics and practical programs for more fundamental details on how ' unicode text and binary data support impact both string and file usage in some rolesplease see learning pythonfourth editionsince this is officially core language topicit enjoys in-depth coverage and full -page dedicated in that book file operation basics besides processing stringsthe more py script also uses files--it opens the external file whose name is listed on the command line using the built-in open functionand it reads that file' text into memory all at once with the file object read method since file objects returned by open are part of the core python language itselfi assume that you have at least passing familiarity with them at this point in the text but just in case you've flipped to this early on in your pythonhoodthe following calls load file' contents into stringload fixed-size set of bytes into stringload file' contents into list of line stringsand load the next line in the file into stringrespectivelyopen('file'read(open('file'read(nopen('file'readlines(open('file'readline(read entire file into string read next bytes into string read entire file into line strings list read next linethrough '\nsystem scripting overview