-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path80_os_module.py
More file actions
17 lines (16 loc) · 783 Bytes
/
Copy path80_os_module.py
File metadata and controls
17 lines (16 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
# print(dir(os)) # prints all functions
print("Current Directory : ", os.getcwd())
# os.chdir("E:\Programming\Python\python_gui")
print("List Directory : ", os.listdir("ex5"))
# os.mkdir("lol") # makes a new folder
# os.makedirs("lol\lmao\Rolf") # makes multiple folders
# os.rename("goodmorning.py","1_hello.py",)
# os.rmdir("lol") # removes empty directory
# os.removedirs("lol") # removes all directory, including all inside
# print("Env variable : ",os.environ.get('path')) # displays all evn var
# print(os.path.join("c://","\python")) # joins 2 paths
# tells if a path exists or not
print("Path exists ? : ", os.path.exists("c:\\"))
print("Is Dir ? : ", os.path.isdir("E:\Programming\Python"))
print("Is file ? : ", os.path.isfile("E:\Programming\Python"))