This content originally appeared on DEV Community and was authored by Ashish Yadav
Introduction to Python OS Module: The OS module in Python provides functions for interacting with the operating system. It offers many useful OS functions that are used to perform OS-based tasks and get related information about operating system. The OS comes under Python's standard utility modules. Lets Start:-
To work with the OS module, we need to import the OS module:
import os
- os.name:
This function gives the name of the operating system dependent module imported. The following names have currently been registered: ‘posix’, ‘nt’, ‘os2’, ‘ce’, ‘java’ and ‘riscos’
Code:
import os
print(os.name)
- os.mkdir() :
This function is used to create new directory.
Code:
import os
print(os.mkdir(path))
For Continue Reading->
???AND Subscribe to Our YouTube Channel bestcodecreator
???AND Support Our Blogging site myblogs
Conclusion:
Thank you for reading this blog. I wish you the best in your journey in learning and mastering in Python Programming??.
This content originally appeared on DEV Community and was authored by Ashish Yadav
Ashish Yadav | Sciencx (2021-05-03T16:58:50+00:00) Complete Guide for OS Module in Python Every Developer should know. Retrieved from https://www.scien.cx/2021/05/03/complete-guide-for-os-module-in-python-every-developer-should-know/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.