0
import os shutil.rmtree('Path') 

It does not delete it and gives me an error. I am using Python 3.7.4 The error is

Traceback (most recent call last): File "C:\Users\Muneeb Khurram\Desktop\gpa.py", line 2, in shutil.rmtree('C:/Users/Muneeb Khurram/Desktop/Py') NameError: name 'shutil' is not defined

1
  • 2
    You need to import shutil first Commented Sep 17, 2019 at 10:09

1 Answer 1

2

First you need to pip install shutil into your computer. And import shutil, before you use shutil.rmtree('Path').

Sign up to request clarification or add additional context in comments.

1 Comment

You don’t need to pip install it’s a part of the python package

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.