Created
April 1, 2022 10:01
-
-
Save feiandxs/db3537e6c567d2aa8a72dead0baa1478 to your computer and use it in GitHub Desktop.
delete all pycache directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def clear(filepath): | |
files = os.listdir(filepath) | |
for fd in files: | |
cur_path = os.path.join(filepath, fd) | |
if os.path.isdir(cur_path): | |
if fd == "__pycache__": | |
print("rm %s -rf" % cur_path) | |
os.system("rm %s -rf" % cur_path) | |
else: | |
clear(cur_path) | |
if __name__ == "__main__": | |
clear("./") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment