Following this answer, I'm trying to delete the contents of a folder with this code
import os
import glob
files = glob.glob('/YOUR/PATH/*')
for f in files:
os.remove(f)
But python returns an Attribution Error "'str' object has no attribute 'remove'". What am I'm doing wrong?
For deleting an entire directory, use shutil.rmtree('/your/path')
Read more from Python docs
Check out a similar question that has already been answered
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With