I have a question about the diff command if I want a recursive directory diff but only for a specific file type, how to do that?
I tried using the exclude option but can
Whilst it does not avoid the actual diff of other files, if your goal is to produce a patch file, or similar then you can use filterdiff from the patchutils package, e.g. to patch only your .py changes:
diff
filterdiff
patchutils
.py
diff -ruNp /path/1 /path/2 | filterdiff -i "*.py" | tee /path/to/file.patch