I've renamed some files in a fairly large project and want to remove the .pyc files they've left behind. I tried the bash script:
rm -r *.pyc
But that doesn't recurse through the folders as I thought it would. What am I doing wrong?
pyc files are placed in the same directory as the . py file. In Python 3.2, the compiled files are placed in a __pycache__ subdirectory, and are named differently depending on which Python interpreter created them. (This can be useful to people importing the same Python modules from multiple versions of Python.)
pyc file is generated, there is no need of *. py file, unless you edit it.
find . -name "*.pyc" -exec rm -f {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With