mmap

The mmap module provides support for a memory-mapped file object. This object behaves both like a file and a string and can be used in most places where an ordinary file or string is expected. Furthermore, the contents of a memory-mapped file are mutable. This means that modifications can be made using index-assignment and slice-assignment operators. Unless a private mapping of the file has been made, such changes directly alter the contents of the underlying file.

A memory-mapping file is created by the mmap() function, which is slightly different on UNIX and Windows.

mmap(fileno, length [, flags, [prot [,access]])

(UNIX) Returns an mmap object that maps length bytes from the file with an integer file descriptor, fileno. flags specifies ...

Get Python: Essential Reference, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.