我找到了自己问题的答案。
import pysftpsrv = pysftp.Connection(host="www.destination.com", username="root",password="password",log="./temp/pysftp.log")with srv.cd('public'): #chdir to public srv.put('C:UsersXXXDropboxtest.txt') #upload file to nodejs/# Closes the connectionsrv.close()放在
srv.put里面
srv.cd



