I am studying módulo os
of the Python
default library and I realize that in many cases a function is allowed to receive as a parameter descritor de arquivo ou diretório
some examples are:
os.fchdir(fd)
Change the current working directory to the directory represented by thefile descriptor fd
. The descriptor mustrefer to an opened directory
, not an open file. As of Python 3.3, this is equivalent to 'os.chdir (fd).
os.supports
_fd ASet object indicating which functions in the os module permit specifying their path parameter as an open file descriptor
. Different platforms provide different functionality, and an option that might work on one could be unsupported on another. For consistency's sakes, functions that support fd always allow specifying the parameter, but will raise an exception if the functionality is not actually available.To check whether a particular function specifies an open file descriptor for its path parameter, use the in operator on supports_fd. As an example, this expression Determines whether os.chdir () accepts open file descriptors when called on your local platform:
os.chdir in os.supports_fd
My questions are:
- What is
descritor de arquivo
? - What is a
descritor de diretório aberto
?