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.
Sur cette page du site, vous pouvez voir la vidéo en ligne #22 Exercise - OS Module in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Afshan - AFS Hackers Academy 22 janvier 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 277 fois et il a aimé 10 téléspectateurs. Bon visionnage!