📅  最后修改于: 2022-03-11 14:45:27.856000             🧑  作者: Mango
As others have said, pipe it into ssh. But what you will want to do is give the proper arguments. You will want to add -u to get the output back from ssh properly. And want to add - to handle the output and later arguments.
ssh user@host python -u - < script.py
If you want to give command line arguments, add them after the -.
ssh user@host python -u - --opt arg1 arg2 < script.py