I'd like to read a file in text mode line-wise, but at the same time I'd like to insert an intermediate step which works on bytes data and basically counts the bytes read so far.
Is there a good way in the standard library to achieve that (without manually opening in bytes mode, searching for newlines, encoding, ...)? At the end I need a text reading object (being used in the CSV reader) which additionally has a byte counter.
tell
method of file objects?.tell()
method is disabled for some reason due to buffering or so. All I need is reading the CSV while counting the number of raw bytes read.