Problems using struct pack/unpack in files, and reading them.
kent nyberg
kent at z-sverige.nu
Fri Nov 13 16:34:50 EST 2015
The main problem was that I forgot to do seek(0). Thanks alot people.
Though, as many times before, the problem was due to misunderstanding of how python works.
I assumed file.read()[xx:yy] was to be understood as, in the file, read from index xx to place yy.
That is, [10:20] was the same as, read from 10th char to 20th. Sort of.
Is it true then to say that every .read of a file, places an index-offset (?) from where the next read starts?
That is, I need to rewind the file, or else the read will start from where the last read stopped?
More information about the Python-list
mailing list