Some answers here https://stackoverflow.com/questions/75103221/emacs-remove-python-el-eval-message
(defun python-comint-filter (output) (let* ((regexp "^.*__PYTHON_EL_\\(.*\\)\\(.*\\)[[:space:]]*$") (lines (split-string output "\n")) (filtered-lines (remove-if (lambda (line) (or (string-match-p regexp line) (string-match-p "^\\s-*$" line))) lines))) (if (equal (length lines) (length filtered-lines)) output (mapconcat 'identity filtered-lines "\n"))))
Some answers here
https://stackoverflow.com/questions/75103221/emacs-remove-python-el-eval-message