string and text handling streamreader(bytestream [errors]returns streamreader instance that is used to read encoded data bytestream is file-like object that has been opened in binary mode errors is the error-handling policy and is 'strictby default an instance of streamreader supports the following low-level / operationsmethod description read([size [chars [firstline]]]returns at most chars characters of decoded text size is the maximum number of bytes to read from low-level byte-stream and is used to control internal buffering firstline is flag thatif setreturns the first line even if decoding error occurs later in the file readline([size [keepends]]returns single line of decoded text keepends is flag that controls whether or not the line endings are preserved (true by defaultr readlines([size [keepends]]reads all of the lines into list reset(resets the internal buffers and state streamwriter(bytestream [errors]returns streamwriter instance that is used to write encoded data bytestream is file-like object that has been opened in byte-mode errors is the error handling policy and is 'strictby default an instance of streamwriter supports the following low-level / operationsmethod description write(sw writelines(linesw reset(writes an encoded representation of string writes list of strings in lines to the file resets the internal buffers and state incrementalencoder([errors]returns an incrementalencoder instance that can be used to encode strings in multiple steps errors is 'strictby default an instance of incrementalencoder has these methodsmethod description encode( [,final]returns an encoded representation of string as byte string final is flag that should be set to true on the final call to encode(resets the internal buffers and state reset( lib fl ff