pydoc > mmap

📘 NAME

mmap

🚀 Quick Reference

Use CaseCommandDescription
Map a file read-onlym = mmap(fileno, length, access=ACCESS_READ)Read-only memory mapping of a file descriptor
Map a file read-writem = mmap(fileno, length, access=ACCESS_WRITE)Read-write mapping, changes propagate to file
Create anonymous memorym = mmap(-1, length)Anonymous mapping (not backed by a file)
Flush modified pagesm.flush([offset, size])Write changes to the underlying file
Get file sizem.size()Return the length of the file underlying the mapping
Read data from mappingdata = m.read(n)Read up to n bytes as a string
Write data to mappingm.write(data)Write the bytes object to the mapping
Seek to a positionm.seek(pos, whence=0)Set the file position for reading/writing
Find a substringpos = m.find(sub, start=0, end=len(m))Return the lowest index where sub is found

📚 Module Reference

https://docs.python.org/3.10/library/mmap.html

The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.

📦 Classes

📄 class mmap(builtins.object)

Windows: mmap(fileno, length[, tagname[, access[, offset]]])

Maps length bytes from the file specified by the file handle fileno, and returns a mmap object. If length is larger than the current size of the file, the file is extended to contain length bytes. If length is 0, the maximum length of the map is the current size of the file, except that if the file is empty Windows raises an exception (you cannot create an empty mapping on Windows).

Unix: mmap(fileno, length[, flags[, prot[, access[, offset]]]])

Maps length bytes from the file specified by the file descriptor fileno, and returns a mmap object. If length is 0, the maximum length of the map will be the current size of the file when mmap is called. flags specifies the nature of the mapping. MAP_PRIVATE creates a private copy-on-write mapping, so changes to the contents of the mmap object will be private to this process, and MAP_SHARED creates a mapping that's shared with all other processes mapping the same areas of the file. The default value is MAP_SHARED.

To map anonymous memory, pass -1 as the fileno (both versions).

Methods defined here:

Static methods defined here:

Data descriptors defined here:

📊 Data

📁 File

/usr/lib/python3.10/lib-dynload/mmap.cpython-310-x86_64-linux-gnu.so

mmap
📘 NAME 🚀 Quick Reference 📚 Module Reference 📦 Classes
📄 class mmap(builtins.object)
📊 Data 📁 File

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 17:02 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^