How to delete cache files in python

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

How to delete cache files in python
How to delete files and directories in python
How to save text files in python
How to wrap in python code
How to omit parentheses in Python
How to write classes in python
How to filter numbers in python
How to read Excel in Python
How to view errors in python
How to write return in python
How to understand variables in Python
How to clear variables in python
How to use SQLite in Python
How to use and and or in Python
How to introduce third-party modules in Python
How to represent null values in python
How to write win programs in python
How to run id function in python
How to install third-party modules in Python
How to custom catch errors in python
How to write try statement in python
How to delete redundant kernels in Ubuntu
How to delete redundant kernels in Ubuntu
How to define private attributes in Python
How to add custom modules in Python
How to understand global variables in Python
How to view installed modules in python
How to open python in different systems
How to sort a dictionary in python
How to add background music in python
How to represent relative path in python
How to use the round function in python
How to use the zip function in Python
How to program based on interfaces in Python
How to install python in ubuntu server environment
How to simulate gravity in a Python game
How to use the format function in python
How to use code running assistant in python
How to set code auto prompt in python
Teach you how to write games in python
How to install the downloaded module in python
Python how to delete rows with empty columns
How to write a confession program in python
How to read and write files with Python
How does Python store data to json files
How to perform continuous multiplication calculation in python
How to comment python code
How to learn python quickly
How to uninstall python plugin
How to understand the introduction of packages in Python
How to understand a list of numbers in python
Example of how to automatically download pictures in python
3 ways to encrypt Python files
How to save IE as an attachment in python
How to understand python objects
How to use python tuples
How to create a Python virtual environment in Ubuntu 14.04
Python implements FTP to upload files in a loop
What are the ways to open files in python
How to find the area of a circle in python
Do you still know how to draw cakes in python? ? ?