Saturday, February 5, 2011

easiest way to rm -rf in python

What is the easiest way to do the equivalent of rm -rf in python?

  • import shutil
    shutil.rmtree("dir-you-want-to-remove")
    
  • shutil.rmtree() is right answer, but just look at another useful function - os.walk()

    From maxp

0 comments:

Post a Comment