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
  [PROBLEM] Removing IDLE from context menu WebSpider 1 1,744 Sep-28-2023, 03:35 PM
Last Post: deanhystad
  with open context inside of a recursive function billykid999 1 1,962 May-23-2023, 02:37 AM
Last Post: deanhystad
  Context-sensitive delimiter ZZTurn 9 4,557 May-16-2023, 07:31 AM
Last Post: Gribouillis
  How does open context manager work? deanhystad 7 3,932 Nov-08-2022, 02:45 PM
Last Post: deanhystad
  Decimal context stevendaprano 1 1,987 Apr-11-2022, 09:44 PM
Last Post: deanhystad
  Time execution of a "for loop" with zip different in 2 equivalent context sebastien 1 2,920 Oct-11-2019, 11:07 AM
Last Post: sebastien
  Is it OK to use a context manager to simplify attribute access? nholtz 0 2,896 Jun-11-2019, 01:19 AM
Last Post: nholtz
  Smtplib: What does context argument means? Pythenx 1 4,461 Mar-27-2019, 06:25 PM
Last Post: nilamo
  eval lambda function with restricted context Olivier 7 8,392 Mar-04-2019, 10:45 PM
Last Post: Olivier
  Dealing with multiple context managers heras 5 9,587 Nov-16-2018, 09:01 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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