Python file.tell gives wrong value location

前端 未结 2 423
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 07:03

I am trying to extract a number of locations from an existing file using Python. This is my current code for extracting the locations:

    self.fh = open( f         


        
2条回答
  •  执笔经年
    2021-01-03 07:30

    I guess I dont understand the issue

    >>> fh = open('test.txt')
    >>> fh.tell()
    0L
    >>> fh.read(1)
    '"'
    >>> fh.tell()
    1L
    >>> fh.read(5)
    'a" \n"'
    >>> fh.tell()
    7L
    

提交回复
热议问题