Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé
Python 3.13.2

Contenu du module « os »

Liste des classes du module os

Nom de la classe Description
DirEntry
GenericAlias Represent a PEP 585 generic type [extrait de GenericAlias.__doc__]
Mapping A Mapping is a generic container for associating key/value [extrait de Mapping.__doc__]
MutableMapping A MutableMapping is a generic container for associating [extrait de MutableMapping.__doc__]
PathLike Abstract base class for implementing the file system path protocol. [extrait de PathLike.__doc__]
stat_result stat_result: Result from stat, fstat, or lstat. [extrait de stat_result.__doc__]
statvfs_result statvfs_result: Result from statvfs or fstatvfs. [extrait de statvfs_result.__doc__]
terminal_size A tuple of (columns, lines) for holding terminal window size [extrait de terminal_size.__doc__]
times_result times_result: Result from os.times(). [extrait de times_result.__doc__]
uname_result uname_result: Result from os.uname(). [extrait de uname_result.__doc__]

Liste des fonctions du module os

Signature de la fonction Description
abort() -> None Interrompt immédiatement le processus en cas d'erreur critique. Abort the interpreter immediately. [extrait de abort.__doc__]
access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True) Use the real uid/gid to test for access to a path. [extrait de access.__doc__]
add_dll_directory(path) Add a path to the DLL search path. [extrait de add_dll_directory.__doc__]
chdir(path: str | bytes | os.PathLike) -> None Cette fonction permet de changer le répertoire courant de travail. Change the current working directory to the specified path. [extrait de chdir.__doc__]
chmod(path: str | bytes | os.PathLike, mode: int, *, dir_fd=None, follow_symlinks=True) -> None Cette fonction permet de changer les droits d'accès d'un fichier ou d'un dossier (chmod = change mode). Change the access permissions of a file. [extrait de chmod.__doc__]
close(fd) Close a file descriptor. [extrait de close.__doc__]
closerange(fd_low, fd_high) Closes all file descriptors in [fd_low, fd_high), ignoring errors. [extrait de closerange.__doc__]
cpu_count() -> int Renvoie le nombre de processeurs logiques disponibles sur la machine. Return the number of logical CPUs in the system. [extrait de cpu_count.__doc__]
device_encoding(fd) Return a string describing the encoding of a terminal's file descriptor. [extrait de device_encoding.__doc__]
dup(fd) Return a duplicate of a file descriptor. [extrait de dup.__doc__]
dup2(fd, fd2, inheritable=True) Duplicate file descriptor. [extrait de dup2.__doc__]
execl(file, *args) execl(file, *args) [extrait de execl.__doc__]
execle(file, *args) execle(file, *args, env) [extrait de execle.__doc__]
execlp(file, *args) execlp(file, *args) [extrait de execlp.__doc__]
execlpe(file, *args) execlpe(file, *args, env) [extrait de execlpe.__doc__]
execv(path, argv) Execute an executable path with arguments, replacing current process. [extrait de execv.__doc__]
execve(path, argv, env) Execute an executable path with arguments, replacing current process. [extrait de execve.__doc__]
execvp(file, args) execvp(file, args) [extrait de execvp.__doc__]
execvpe(file, args, env) execvpe(file, args, env) [extrait de execvpe.__doc__]
fchmod(fd: int, mode: int) -> None Cette fonction permet de changer les droits d'accès d'un fichier ou d'un dossier (fchmod = file change mode). Change the access permissions of the file given by file descriptor fd. [extrait de fchmod.__doc__]
fdopen(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)
fsdecode(filename) Decode filename (an os.PathLike, bytes, or str) from the filesystem [extrait de fsdecode.__doc__]
fsencode(filename) Encode filename (an os.PathLike, bytes, or str) to the filesystem [extrait de fsencode.__doc__]
fspath(path) Return the file system path representation of the object. [extrait de fspath.__doc__]
fstat(fd) Perform a stat system call on the given file descriptor. [extrait de fstat.__doc__]
fsync(fd) Force write of fd to disk. [extrait de fsync.__doc__]
ftruncate(fd, length) Truncate a file, specified by file descriptor, to a specific length. [extrait de ftruncate.__doc__]
get_blocking(fd) Get the blocking mode of the file descriptor. [extrait de get_blocking.__doc__]
get_exec_path(env=None) Returns the sequence of directories that will be searched for the [extrait de get_exec_path.__doc__]
get_handle_inheritable(handle) Get the close-on-exe flag of the specified file descriptor. [extrait de get_handle_inheritable.__doc__]
get_inheritable(fd) Get the close-on-exe flag of the specified file descriptor. [extrait de get_inheritable.__doc__]
get_terminal_size Return the size of the terminal window as (columns, lines). [extrait de get_terminal_size.__doc__]
getcwd() -> str Cette fonction permet de récupérer le chemin du répertoire de travail courant (getcwd = get current working directory) Return a unicode string representing the current working directory. [extrait de getcwd.__doc__]
getcwdb() Return a bytes string representing the current working directory. [extrait de getcwdb.__doc__]
getenv(key, default=None) Get an environment variable, return None if it doesn't exist. [extrait de getenv.__doc__]
getlogin() Return the actual login name. [extrait de getlogin.__doc__]
getpid() Return the current process id. [extrait de getpid.__doc__]
getppid() Return the parent's process id. [extrait de getppid.__doc__]
isatty(fd) Return True if the fd is connected to a terminal. [extrait de isatty.__doc__]
kill(pid, signal) Kill a process with a signal. [extrait de kill.__doc__]
lchmod(path, mode) Change the access permissions of a file, without following symbolic links. [extrait de lchmod.__doc__]
link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True) Create a hard link to a file. [extrait de link.__doc__]
listdir(path: str) -> List[str] Renvoie la liste des entrées dans le répertoire donné par le chemin. Return a list containing the names of the files in the directory. [extrait de listdir.__doc__]
listdrives() Return a list containing the names of drives in the system. [extrait de listdrives.__doc__]
listmounts(volume) Return a list containing mount points for a particular volume. [extrait de listmounts.__doc__]
listvolumes() Return a list containing the volumes in the system. [extrait de listvolumes.__doc__]
lseek(fd, position, whence) Set the position of a file descriptor. Return the new position. [extrait de lseek.__doc__]
lstat(path, *, dir_fd=None) Perform a stat system call on the given path, without following symbolic links. [extrait de lstat.__doc__]
makedirs(path: str | bytes | os.PathLike, mode: int = 0o777, exist_ok: bool = False) -> None Cette fonction permet de créer un nouveau dossier mais aussi les dossiers intermédiaires qui pourraient ne pas exister. makedirs(name [, mode=0o777][, exist_ok=False]) [extrait de makedirs.__doc__]
mkdir(path: str | bytes | os.PathLike, mode: int = 0o777, *, dir_fd: int = None) -> None Cette fonction permet de créer un nouveau dossier (mkdir = MaKe DIRectory). Create a directory. [extrait de mkdir.__doc__]
open(path, flags, mode=511, *, dir_fd=None) Open a file for low level IO. Returns a file descriptor (integer). [extrait de open.__doc__]
pipe() Create a pipe. [extrait de pipe.__doc__]
popen(cmd, mode='r', buffering=-1)
putenv(name, value) Change or add an environment variable. [extrait de putenv.__doc__]
read(fd, length) Read from a file descriptor. Returns a bytes object. [extrait de read.__doc__]
readlink(path, *, dir_fd=None) Return a string representing the path to which the symbolic link points. [extrait de readlink.__doc__]
remove(path, *, dir_fd=None) Remove a file (same as unlink()). [extrait de remove.__doc__]
removedirs(name) removedirs(name) [extrait de removedirs.__doc__]
rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename a file or directory. [extrait de rename.__doc__]
renames(old, new) renames(old, new) [extrait de renames.__doc__]
replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename a file or directory, overwriting the destination. [extrait de replace.__doc__]
rmdir(path: str | bytes | os.PathLike, *, dir_fd: int = None) -> None Cette fonction permet de supprimer le dossier spécifié en paramètre (rmdir = ReMove DIRectory). Remove a directory. [extrait de rmdir.__doc__]
scandir(path='.') -> os.DirEntry La fonction scandir permet d'itérer sur les entrées d'un répertoire de manière efficace. Return an iterator of DirEntry objects for given path. [extrait de scandir.__doc__]
set_blocking(fd, blocking) Set the blocking mode of the specified file descriptor. [extrait de set_blocking.__doc__]
set_handle_inheritable(handle, inheritable) Set the inheritable flag of the specified handle. [extrait de set_handle_inheritable.__doc__]
set_inheritable(fd, inheritable) Set the inheritable flag of the specified file descriptor. [extrait de set_inheritable.__doc__]
spawnl(mode, file, *args) spawnl(mode, file, *args) -> integer [extrait de spawnl.__doc__]
spawnle(mode, file, *args) spawnle(mode, file, *args, env) -> integer [extrait de spawnle.__doc__]
spawnv(mode, path, argv) Execute the program specified by path in a new process. [extrait de spawnv.__doc__]
spawnve(mode, path, argv, env) Execute the program specified by path in a new process. [extrait de spawnve.__doc__]
startfile Start a file with its associated application. [extrait de startfile.__doc__]
stat(path, *, dir_fd=None, follow_symlinks=True) Perform a stat system call on the given path. [extrait de stat.__doc__]
strerror(code) Translate an error code to a message string. [extrait de strerror.__doc__]
symlink(src, dst, target_is_directory=False, *, dir_fd=None) Create a symbolic link pointing to src named dst. [extrait de symlink.__doc__]
system(command) Execute the command in a subshell. [extrait de system.__doc__]
times() Return a collection containing process timing information. [extrait de times.__doc__]
truncate(path, length) Truncate a file, specified by path, to a specific length. [extrait de truncate.__doc__]
umask(mask) Set the current numeric umask and return the previous umask. [extrait de umask.__doc__]
unlink(path, *, dir_fd=None) Remove a file (same as remove()). [extrait de unlink.__doc__]
unsetenv(name) Delete an environment variable. [extrait de unsetenv.__doc__]
urandom(size) Return a bytes object containing random bytes suitable for cryptographic use. [extrait de urandom.__doc__]
utime Set the access and modified time of path. [extrait de utime.__doc__]
waitpid(pid, options) Wait for completion of a given process. [extrait de waitpid.__doc__]
waitstatus_to_exitcode(status) Convert a wait status to an exit code. [extrait de waitstatus_to_exitcode.__doc__]
walk(top, topdown=True, onerror=None, followlinks=False) Directory tree generator. [extrait de walk.__doc__]
write(fd, data) Write a bytes object to a file descriptor. [extrait de write.__doc__]

Liste des variables globales du module os

Nom de la variable globale Valeur
altsep /
curdir .
defpath .;C:\bin
devnull nul
environ Contenu de type <class 'os._Environ'>
EX_OK 0
extsep .
F_OK 0
linesep
name nt
O_APPEND 8
O_BINARY 32768
O_CREAT 256
O_EXCL 1024
O_NOINHERIT 128
O_RANDOM 16
O_RDONLY 0
O_RDWR 2
O_SEQUENTIAL 32
O_SHORT_LIVED 4096
O_TEMPORARY 64
O_TEXT 16384
O_TRUNC 512
O_WRONLY 1
P_DETACH 4
P_NOWAIT 1
P_NOWAITO 3
P_OVERLAY 2
P_WAIT 0
pardir ..
pathsep ;
R_OK 4
SEEK_CUR 1
SEEK_END 2
SEEK_SET 0
sep \
supports_bytes_environ False
supports_dir_fd set()
supports_effective_ids set()
supports_fd {<built-in function chmod>, <built-in function stat>, <built-in function truncate>}
supports_follow_symlinks {<built-in function chmod>, <built-in function stat>}
TMP_MAX 2147483647
W_OK 2
X_OK 1

Liste des alias du module os

Nom de l'alias Définition ciblée
error OSError
process_cpu_count cpu_count


Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé