This module contains miscellaneous operating system functions.
All filesystem operations accept absolute paths only and will raise a
ValueError when passed an invalid path.
Obtain a list of names or the entries in the provided directory.
pathis provided in type
bytes, the filenames returned are also of type
bytes; otherwise they are of type
The list is in an arbitrary order and does not include special entries such as
.., even if they are present in the directory. If a file is removed from or added to the directory during this function call, its appearance or otherwise is undetermined.
path (str or bytes) – Full path to the directory.
List containing the names of the entries in the directory.
- Return type
str or bytes
- uos.mkdir(path, mode=None)¶
Create a directory.
path (str) – Full path to the new directory.
mode (optional) – This parameter is ignored and is only present to ensure compatibility.
FileExistsError – Directory already exists.
Remove (delete) a file.
path (str) – Full path to the file.
IsADirectoryError – The provided
pathis a directory rather than a file. Use
rmdir()to remove directories.
FileNotFoundError – File does not exist.
Remove (delete) a directory.
path (str) – Full path to the directory.
FileNotFoundError – The directory does not exist.
OSError – Directory is not empty.