How to Remove all Duplicate Files on your Drive via Python using Python programming. Python programming can ultimately save a lot of space on your drive by removing all the duplicates. We are going to use Python's OS deleting tool to remove all the duplicate files on our drive. We will use the Python standard library to use hashlib to hash a string in Python using md5 and hexdigest to generate a binary hash of a given file. The value of the generated hash doesn't change as long as it's the same file.