Computer Science · Ch 2 — File Handling in Python
Setting Offsets in a File
2.6
Setting Offsets in a File
The functions you have learnt so far — read(), readline(), readlines(), write(), writelines() — all access data sequentially: the file pointer moves forward as you read or write, and you cannot easily jump back to an earlier part of the file or ahead to a specific position. But real-world programs often need to access data in a random fashion — for example, jumping straight to a particular record without reading everything before it. Python gives you the …