tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code05:03

Python delete a file 🗑️

Bro Code ↗

From the creator

Python delete file tutorial example explained #python #delete #file import os import shutil path = "test.txt" try: os.remove(path) #delete a file #os.rmdir(path) #delete an empty directory #shutil.rmtree(path)#delete a directory containing files except FileNotFoundError: print("That file was not found") except PermissionError: print("You do not have permission to delete that") except OSError: print("You cannot delete that using that function") else: print(path+" was deleted") Bro Code merch store: https://teespring.com/stores/bro-code-5

Published 2020-12-21 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code