OS Module
This gives our code an immediate association with the working framework. They have a ton of underlying capacities.
dir(os) - It provides us with a rundown of the relative multitude of capacities the OS module is made out of.
os. getcwd() - The capacity returns us the way of the index we are right now in. It is essential to be aware of our index since when we are attempting to import a document in python, the compiler looks for it in our present catalog.
os. chdir( ) - It is utilized on the off chance that we need to change our catalog. The new way is sent inside the enclosure. To get to certain records or envelopes from another catalog, we can utilize it.
os. listdir( ) - If we need to yield the names of the multitude of registries at a specific area, we can utilize this capacity.
os.mkdir( ) - To make another index or envelope. The name is sent as a boundary inside the bracket.
os. makedirs( ) - To make more than on registry all the while.
os.rename( ) - To rename an all-around existing registry, we utilize this. We send the current name and new name of our catalog as boundaries.
os.rmdir( ) - It erases a vacant registry.
os.removedirs( ) - We can eliminate all indexes inside a catalog
os. environ.get( ) - It will return us the climate variable. The climate variable should be set, or the capacity will bring invalid back.
os. path.join( ) - It goes along with at least one-way parts. We can join the ways by essentially utilizing a + sign, however, the advantage of utilizing this capacity is that we don't need to stress over additional slices between the parts. So less exactness gives us a similar outcome.
os. path.exists( ) - It returns us a Boolean worth, i.e., either evident or bogus. It is utilized to check whether or not a way exists.
os.path.isfile( ) - It returns valid in the event that the way is a current customary document.
os.path.isdir( ) - It returns valid assuming the way is a current registry.

0 Comments