Python os.removedirs() Method

Syntax

os.removedirs( path )

Parameter Details

Return Value

Example

# !/usr/bin/python

import os, sys

# listing directories
print "The dir is: %s" %os.listdir(os.getcwd())

# removing
os.removedirs("/tutorialsdir")

# listing directories after removing directory
print "The dir after removal is:" %os.listdir(os.getcwd())

Output

The dir is: [ 'a1.txt','resume.doc','a3.py','tutorialsdir','amrood.admin' ] The dir after removal is: [ 'a1.txt','resume.doc','a3.py','amrood.admin' ]

--

--

--

A tutorial blog that provides tutorials on Web Design, Programming, Java Technologies, Mobile App Development, Database, Machine Learning, etc.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

An update to our roadmap

THE ADVANTAGES OF CRODO

SWIFTUI: modal views to the custom navigation framework

PancakeSwap Revelation Hackathon by BNB Chain

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

Massive data in Mapbox Studio Classic with PostGIS + SQL

Learn Go (Golang) from Microsoft for free!

How to Write Atomic Repositories in Go

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Web Design Tutorialz

Web Design Tutorialz

A tutorial blog that provides tutorials on Web Design, Programming, Java Technologies, Mobile App Development, Database, Machine Learning, etc.

More from Medium

Lambda in Python

Generator in Python

Python Generator

While Loops in Python