xxxxxxxxxx
import os
# Get the current working directory
current_dir = os.getcwd()
print("Current Directory:", current_dir)
xxxxxxxxxx
# Delete everything reachable from the directory named in "top",
# assuming there are no symbolic links.
# CAUTION: This is dangerous! For example, if top == '/', it
# could delete all your disk files.
import os
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
xxxxxxxxxx
#import os in python: a realized way.
import os
path= "C:\\Users\\88013\\Desktop\\New folder"
if os.path.exists(path):
print("We got that information")
if os.path.isfile(path):
print("This is a text file format")
elif os.path.isdir(path):
print("This is a Folder")
else:
print("Find the File in Hard-Disk")