#!/bin/bash

#
# cleanup.sh
#
find . -type f -name '*.py[co]' -exec rm -v {} \;
find . -type f -name '*~' -exec rm -v {} \;
find . -type d -name '__pycache__' -exec rmdir -v {} \;

#!/bin/bash

#
# cleanup.sh
#
find . -type f -name '*.py[co]' -delete
find . -type f -name '*~' -delete
find . -type d -name '__pycache__' -delete

Use the -delete option of the find command.
Use the -delete option of the find command.