In [1]:
import os
In [2]:
os.makedirs('temp/dir1/dir2/dir3/', exist_ok=True)
In [3]:
with open('temp/file.txt', 'w') as f:
f.write('')
In [4]:
print(os.listdir('temp/'))
In [5]:
os.removedirs('temp/dir1/dir2/dir3/')
In [6]:
print(os.listdir('temp/'))
In [7]:
os.remove('temp/file.txt')