Home:ALL Converter>Python text file instead of dictionary

Python text file instead of dictionary

Ask Time:2014-07-22T16:15:54         Author:g0m3z

Json Formatter

I'm working on a project where I crawl and re-organize huge number of data into a result text file. Previously I used dictionary to store temporary data, but as the data volume increased the process slowed down because of memory usage and dictionary got useless.

Since process speed is not so important in my case, I'm trying to replace dictionary to file but I'm not sure how can I easily move file pointer to appropriate position and read up required data. In dictionary I can easily refer to any data. I would like to achieve the same but in file.

I'm thinking to use mmap and write my own functions to move file pointer where I want. Does Python have a built-in or 3rd party module for such operations?

Any other theoretical approach is welcome.

Author:g0m3z,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/24882154/python-text-file-instead-of-dictionary
yy