Category Archives: examples

Delete a file or folder in Python

Python provides the os.remove and os.unlink functions to delete files and os.rmdir and shutil.rmtree to delete directories. Python 3.4+ offers an additional module called pathlib and two functions called unlink (deletes a file or symbolic link) and rmtree (deletes an empty directory).

Continue reading

How to open Python files

The Python files have the .py extension. These files can be opened and edited in many different applications. Some of them are simple, and the other offers many features that are useful when you work with Python files.

Continue reading