[Python] random access to text lines
linecache 모듈은 텍스트파일에 대한 랜덤 액세스를 라인 단위로 제공한다. 대용량의 데이터를 메모리에 로딩하지 않고 파일에 직접 접근해서 사용할 수 있다.
Example
Reference
http://www.python.org/doc/2.4.2/lib/module-linecache.html
Example
>>> import linecache
>>> linecache.getline('/etc/passwd', 4)
'sys:x:3:3:sys:/dev:/bin/sh\n'
>>> linecache.getline('/etc/passwd', 4)
'sys:x:3:3:sys:/dev:/bin/sh\n'
Reference
http://www.python.org/doc/2.4.2/lib/module-linecache.html
