#22 Exercise - OS Module in Python

Veröffentlicht am: 22 Januar 2023
auf dem Kanal: 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.


Auf dieser Seite können Sie das Online-Video #22 Exercise - OS Module in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Afshan - AFS Hackers Academy 22 Januar 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 277 Mal angesehen und es wurde von 10 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!