#22 Exercise - OS Module in Python

Publicado el: 22 enero 2023
en el canal de: Afshan - AFS Hackers Academy
277
10

In this video, we're gonna learn about the python OS module.

Python OS module provides the facility to establish the interaction between the user and the operating system.
It offers many useful OS functions that are used to perform OS-based tasks and get related information about operating system.

Timestamp:
00:00:08 - Overview of OS module

00:00:31 - Using the os module, create a variable called "current_directory" that holds the current working directory.

00:01:48 - Use the os.listdir() method to create a list of all the files in the current working directory and print the list.

00:03:35 - Use the os.mkdir() method to create a new directory called "test_directory".

00:04:38 - Use the os.rmdir() method to delete the "test_directory" that you just created.

00:05:32 - Create a file called "test_file.txt" in the current working directory using the open() function.

00:06:26 - Use the os.rename() method to rename the "test_file.txt" to "renamed_file.txt".

00:07:37 - Use the os.path.isdir() method to check if a directory called "test_directory" exists and print the result.

00:08:45 - Use the os.path.abspath() method to print the absolute path of a file called "renamed_file.txt".

00:09:48 - Use the os.path.isfile() method to check if a file called "renamed_file.txt" exists and print the result.

00:10:52 - Use the os.path.getsize() method to get the size of "renamed_file.txt" and print the result.


En esta página del sitio puede ver el video en línea #22 Exercise - OS Module in Python de Duración hora minuto segunda en buena calidad , que subió el usuario Afshan - AFS Hackers Academy 22 enero 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 277 veces y le gustó 10 a los espectadores. Disfruta viendo!