Skip to main content

A python package that can fast random access any lines in a large file without high memory cost.

Project description

LineCache caches the line position of a file in the memory. Everytime it access a line, it will seek to the related postion and readline().

Noticing that it may cost some time when you first cache lines of a file.

Usage:

from linecache_light import LineCache

linecache = LineCache(‘a.txt’, cache_suffix=’.cache’)

num_lines = len(linecache)

line_0 = linecache[0]

line_100 = linecache[100]

line_indexing= linecache[[2,3,4,5]]

line_indexing = linecache[-1]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for linecache-light, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size linecache-light-0.1.4.linux-x86_64.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page