Python delete cache file method:
First enter "find.-name'pycache' -type d -exec rm -rf {} " command to delete all subdirectories;
Then enter the "find.-name "*.pyc"" command to delete the .pyc file.
Delete all pycache subdirectories in the current directory
find .-name '__pycache__'-type d -exec rm -rf {} \
Delete all .pyc files in the current directory
find .-name "*.pyc"| xargs rm -f
Knowledge point expansion:
Clear cache or memory in Python
problem:
I have a very large table to calculate (10 billion+ rows). It takes too long to calculate all these at once. Therefore, I created a list of breakpoints, calculated and stored at the end of each step. However, each step takes longer. I think the cause is memory or cache, do you know what to do in this case, or just how to clear cache or memory?
I reuse the variable for the output in the loop, so the variable does not get bigger and bigger.
solution
I usually use the following code to solve this problem: reset the variables at the end of the process, thereby clearing the cache:
MyVariable = None
The above is the details of how python deletes cache files. For more information about how to delete cache files in python, please follow other related articles on ZaLou.Cn!
Recommended Posts