The OS module is a python module that provides the interface for interacting with the underlying operating system that Python is running.
This module provides a portable way of using *operating system *dependent functionality.
OS module comes by default on Python’s standard utility modules therefore you don’t need to install anything to start using it
OS module provides a ton of** methods** of which you use in variety of situation in interacting *with the *operating system ranging from_ creating new file & folder_s to renaming and _deleting t_hem.
You can view all of them by using dir() as shown below
>>>import os >>>dir(os) 'chown', 'chroot', 'close', 'closerange', 'confstr', 'confstr_names', 'cpu_count', 'ctermid', 'curdir', 'defpath', 'device_encoding', 'posix_fallocate', 'pread', 'putenv', 'pwrite', 'read', 'readlink', 'readv', 'remove', 'removedirs', 'removexattr', 'rename', 'renames' ............................and so on...........................
On this tutorial We will just check some of methods on OS Module
This OS method is used to get the path of the current working directory.
>>>import os >>>os.getcwd() #getting path of current directory '/home/kalebu'
In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.
Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?
Are you looking for experienced, reliable, and qualified Python developers? If yes, you have reached the right place. At **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")**, our full-stack Python development services...
Magic Methods are the special methods which gives us the ability to access built in syntactical features such as ‘<’, ‘>’, ‘==’, ‘+’ etc.. You must have worked with such methods without knowing them to be as magic methods. Magic methods can be identified with their names which start with __ and ends with __ like __init__, __call__, __str__ etc. These methods are also called Dunder Methods, because of their name starting and ending with Double Underscore (Dunder).
Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.