The os module

import os
current_dir = os.getcwd()
print(current_dir)
/Users/yogesh/projects/pyfiddle/web/home
os.mkdir("new_directory")
open("new.txt", "w").close()
os.listdir()
['new_directory', 'example.txt', 'new.txt']
os.rename("new_directory", "renamed_directory")
os.listdir()
['renamed_directory', 'example.txt', 'new.txt']
os.remove("new.txt")
os.rmdir("renamed_directory")
os.listdir()
['example.txt']
import os
home_dir = os.getenv("HOME")
print(home_dir)
/Users/yogesh
import os
os.environ["MY_VARIABLE"] = "my_value"
print(os.environ["MY_VARIABLE"])
my_value