Python Forum

Full Version: TextIOWrapper.tell() with Python 3.6.9 in context of 0D/0A
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When running:

   fh  = open("tmp.txt", "r")
    while 1 + 1 == 2:
        tmp = fh.read(1)
        if not tmp: break
        print(fh.tell(), "%x" % ord(tmp))

On a file 'tmp.txt' produced by

Quote:> echo -e "\x41\x42\x3b\x0d\x0a\x0d\x0a" > tmp.txt

I am getting the output:

Output:
1 41 2 42 18446744073709551620 3b 5 a 7 a 8 a
I this still considered a correct behavior? Where does the 2**64 come from? I would suggest that moving forward in the stream is monotonous with the position-not necessarily linear.
(This is a short form of my question at stackoeverflow.com: https://stackoverflow.com/questions/6090...t-of-0d-0a)