<jupyter_start><jupyter_text>OS Module OS module is one of the important module which is useful in directly interaction with the OS and the file system ie.directories and files.It provides various functions through which we can interact with underlying OS.To understand it in a better way let us consider few examples : OS module is a python's builtin module.To use it like any other modules first we have to import it into our current file<jupyter_code>import os  #importing the os module must be the first statement
print(os.name)<jupyter_output>posix<jupyter_text>Depending on the name of the os module we get the output.It varies from system to system with different OS like windows ,linux etc.<jupyter_code>os.getcwd()<jupyter_output><empty_output><jupyter_text>getcwd function is used to return the current working directory.For windows users you will o/p something like C:\Users\user_name\...<jupyter_code>os.path.abspath('.') # returns absolute path
os.listdir('.')  # list the directories and the files in the current directory<jupyter_output><empty_output><jupyter_text>Environment Variables<jupyter_code>os.environ   # Returns all the environment variables
os.getenv('HOME')  # to get the environment variable for a specific directory or the path<jupyter_output><empty_output><jupyter_text>File Object System Manipulation  For working with files io we need to have one must thing i.e file descriptor of the file which we are going to manipulate<jupyter_code>fd = "GFG.txt" 
f = open(fd, 'w') # opening file in write mode
f.write("Python Rocks") 
f.close() # closing the file

f = open(fd, 'r') # opening file in read mode
message = f.read() 
print(message)<jupyter_output>Python Rocks
{'fraction_non_alphanumeric': 0.07079646017699115, 'fraction_numerical': 0.0, 'mean_word_length': 5.5482625482625485, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '435981', 'license': 'MIT', 'n_tokens_mistral': 491, 'n_tokens_neox': 485, 'n_words': 209, 'path': 'Runtime Features/os.ipynb', 'repo_name': 'Sirius79/pypackages', 'size': '1695'}