Advertisement
VanoHa

delete files

Nov 28th, 2022
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import os
  2.  
  3. path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test.txt')
  4. os.remove(path)
  5.  
  6. import os
  7.  
  8. path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'TestDir')
  9. os.rmdir(path)
  10.  
  11. import os
  12. import shutil
  13.  
  14. path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'TestDir')
  15. shutil.rmtree(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement