So the course that I am teaching has a requirement to teach the concept of random files - the course content specifies that the files are of a fixed size/length, each location contains a record, and the location in which to store/from which to read is determined through a hashing function (with collisions dealt with in a number of ways). While I am happy with the theory, and the pseudocode that is used to explain this concept, I have to admit, I am struggling with turning this into suitable Python code.
What I need is to be able to
- use a key value and a hashing function to determine a line number in a file (I can do this part)
- jump to that line/location in a specified file
- amend or read the data on that line/at that location
I have seen a couple of mentions of pickling and mmap'ing when doing a bit of research but not sure if this would be the best approach. Very grateful for any guidance.