mmap module supplies memory-mapped file objects. An
mmap object behaves similarly to a plain (not Unicode) string, so you can often pass an
mmap object where a plain string is expected. However, there are differences:
mmap object does not supply the methods of a string object.
mmap object is mutable, while string objects are immutable.
mmap object also corresponds to an open file and behaves polymorphically to a Python file object (as covered in File-Like Objects and Polymorphism).
m can be indexed or sliced, yielding plain strings. Since
m is mutable, you can also assign to an indexing or slicing of
m. However, when you assign to a slice of
m, the righthand side of the assignment statement must be a string of exactly the same length as the slice you’re assigning to. Therefore, many of the useful tricks available with list slice assignment (covered in Modifying a list) do not apply to
mmap slice assignment.
mmap supplies a factory function that is slightly different on Unix-like systems and Windows.
Creates and returns an