moves to position in the file technicallyos calls process files by their descriptorswhich are integer codes or "handlesthat identify files in the operating system descriptor-based files deal in raw bytesand have no notion of the line-end or unicode translations for text that we studied in the prior section in factapart from extras like bufferingdescriptor-based files generally correspond to binary mode file objectsand we similarly read and write bytes stringsnot str strings howeverbecause the descriptor-based file tools in os are lower level and more complex than the built-in file objects created with the built-in open functionyou should generally use the latter for all but very special file-processing needs using os open files to give you the general flavor of this tool setthoughlet' run few interactive experiments although built-in file objects and os module descriptor files are processed with distinct tool setsthey are in fact related--the file system used by file objects simply adds layer of logic on top of descriptor-based files in factthe fileno file object method returns the integer descriptor associated with built-in file object for instancethe standard stream file objects have descriptors and calling the os write function to send data to stdout by descriptor has the same effect as calling the sys stdout write methodimport sys for stream in (sys stdinsys stdoutsys stderr)print(stream fileno() sys stdout write('hello stdio world\ 'hello stdio world import os os write( 'hello descriptor world\ 'hello descriptor world write via file method write via os module because file objects we open explicitly behave the same wayit' also possible to process given real external file on the underlying computer through the built-in open functiontools in the os moduleor both (some integer return values are omitted here for brevity)for instanceto process pipesdescribed in the python os pipe call returns two file descriptorswhich can be processed with os module file tools or wrapped in file object with os fdopen when used with descriptor-based file tools in ospipes deal in byte stringsnot text some device files may require lower-level control as well file and directory tools