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.
На этой странице сайта вы можете посмотреть видео онлайн #22 Exercise - OS Module in Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Afshan - AFS Hackers Academy 22 Январь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 277 раз и оно понравилось 10 зрителям. Приятного просмотра!