Python Forum
TextIOWrapper.tell() with Python 3.6.9 in context of 0D/0A
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TextIOWrapper.tell() with Python 3.6.9 in context of 0D/0A
#1
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Context-sensitive delimiter ZZTurn 9 1,488 May-16-2023, 07:31 AM
Last Post: Gribouillis
  How does open context manager work? deanhystad 7 1,336 Nov-08-2022, 02:45 PM
Last Post: deanhystad
  Decimal context stevendaprano 1 1,046 Apr-11-2022, 09:44 PM
Last Post: deanhystad
  Smtplib: What does context argument means? Pythenx 1 3,088 Mar-27-2019, 06:25 PM
Last Post: nilamo
  Dealing with multiple context managers heras 5 4,708 Nov-16-2018, 09:01 AM
Last Post: DeaD_EyE
  Context Manager (with) wyattbiker 3 3,788 Jul-23-2018, 03:19 PM
Last Post: snippsat
  unexpected text file output <_io.TextIOWrapper… encoding='cp1252'> sleepylog 3 12,814 Aug-20-2017, 12:06 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020