How do I achieve find . -name "*.py" in finder
The asterisk is not a glob in Finder/Spotlight search.
Try the search without the asterisk: type .py then choose ‘Name matches: .py’ from the dropdown.
However, searching for file extensions is not the usual way to use Spotlight search, and you can't pin the filename search to the end of the filename using Finder. Instead, Spotlight can understand what a Python source file is, so you can search for python and choose ‘Python Source’ for more accurate searches.