{
    "mode": "pydoc",
    "parameter": "select",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/select/json",
    "generated": "2026-06-02T15:02:23Z",
    "sections": {
        "NAME": {
            "content": "select - This module supports asynchronous I/O on multiple file descriptors.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "* IMPORTANT NOTICE *\nOn Windows, only sockets are supported; on Unix, all file descriptors.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.object\nepoll\n",
            "subsections": [
                {
                    "name": "class epoll",
                    "content": "|  select.epoll(sizehint=-1, flags=0)\n|\n|  Returns an epolling object\n|\n|  sizehint must be a positive integer or -1 for the default size. The\n|  sizehint is used to optimize internal data structures. It doesn't limit\n|  the maximum number of monitored events.\n|\n|  Methods defined here:\n|\n|  enter(self, /)\n|\n|  exit(self, exctype=None, excvalue=None, exctb=None, /)\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  close(self, /)\n|      Close the epoll control file descriptor.\n|\n|      Further operations on the epoll object will raise an exception.\n|\n|  fileno(self, /)\n|      Return the epoll control file descriptor.\n|\n|  modify(self, /, fd, eventmask)\n|      Modify event mask for a registered file descriptor.\n|\n|      fd\n|        the target file descriptor of the operation\n|      eventmask\n|        a bit set composed of the various EPOLL constants\n|\n|  poll(self, /, timeout=None, maxevents=-1)\n|      Wait for events on the epoll file descriptor.\n|\n|        timeout\n|          the maximum time to wait in seconds (as float);\n|          a timeout of None or -1 makes poll wait indefinitely\n|        maxevents\n|          the maximum number of events returned; -1 means no limit\n|\n|      Returns a list containing any descriptors that have events to report,\n|      as a list of (fd, events) 2-tuples.\n|\n|  register(self, /, fd, eventmask=7)\n|      Registers a new fd or raises an OSError if the fd is already registered.\n|\n|        fd\n|          the target file descriptor of the operation\n|        eventmask\n|          a bit set composed of the various EPOLL constants\n|\n|      The epoll interface supports all file descriptors that support poll.\n|\n|  unregister(self, /, fd)\n|      Remove a registered file descriptor from the epoll object.\n|\n|      fd\n|        the target file descriptor of the operation\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromfd(fd, /) from builtins.type\n|      Create an epoll object from a given control fd.\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  closed\n|      True if the epoll handler is closed\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "poll",
                    "content": "Returns a polling object.\n\nThis object supports registering and unregistering file descriptors, and then\npolling them for I/O events.\n"
                },
                {
                    "name": "select",
                    "content": "Wait until one or more file descriptors are ready for some kind of I/O.\n\nThe first three arguments are iterables of file descriptors to be waited for:\nrlist -- wait until ready for reading\nwlist -- wait until ready for writing\nxlist -- wait for an \"exceptional condition\"\nIf only one kind of condition is required, pass [] for the other lists.\n\nA file descriptor is either a socket or file object, or a small integer\ngotten from a fileno() method call on one of those.\n\nThe optional 4th argument specifies a timeout in seconds; it may be\na floating point number to specify fractions of seconds.  If it is absent\nor None, the call will never time out.\n\nThe return value is a tuple of three lists corresponding to the first three\narguments; each contains the subset of the corresponding file descriptors\nthat are ready.\n\n* IMPORTANT NOTICE *\nOn Windows, only sockets are supported; on Unix, all file\ndescriptors can be used.\n"
                }
            ]
        },
        "DATA": {
            "content": "EPOLLERR = 8\nEPOLLET = 2147483648\nEPOLLEXCLUSIVE = 268435456\nEPOLLHUP = 16\nEPOLLIN = 1\nEPOLLMSG = 1024\nEPOLLONESHOT = 1073741824\nEPOLLOUT = 4\nEPOLLPRI = 2\nEPOLLRDBAND = 128\nEPOLLRDHUP = 8192\nEPOLLRDNORM = 64\nEPOLLWRBAND = 512\nEPOLLWRNORM = 256\nEPOLLCLOEXEC = 524288\nPIPEBUF = 4096\nPOLLERR = 8\nPOLLHUP = 16\nPOLLIN = 1\nPOLLMSG = 1024\nPOLLNVAL = 32\nPOLLOUT = 4\nPOLLPRI = 2\nPOLLRDBAND = 128\nPOLLRDHUP = 8192\nPOLLRDNORM = 64\nPOLLWRBAND = 512\nPOLLWRNORM = 256\n",
            "subsections": []
        },
        "FILE": {
            "content": "(built-in)\n\n",
            "subsections": []
        }
    },
    "summary": "select - This module supports asynchronous I/O on multiple file descriptors.",
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Bash builtin construct for creating menus.",
        "examples": [
            {
                "description": "Create a menu out of individual words",
                "command": "select {{word}} in {{apple orange pear banana}}; do echo ${{word}}; done"
            },
            {
                "description": "Create a menu from the output of another command",
                "command": "select {{line}} in $({{command}}); do echo ${{line}}; done"
            },
            {
                "description": "Specify the prompt string for `select` and create a menu for picking a file or folder from the current directory",
                "command": "PS3=\"{{Select a file: }}\"; select {{file}} in *; do echo ${{file}}; done"
            },
            {
                "description": "Create a menu from a Bash array",
                "command": "{{fruits}}=({{apple orange pear banana}}); select {{word}} in ${{{fruits[@}}}; do echo ${{word}}; done"
            }
        ]
    }
}