This article example describes python using paramiko to realize the remote copy file method. Shared for your reference, as follows:
The first step is to install the paramiko library (which implements the SSH2 security protocol), which can be installed under ubuntu directly from the source.
sudo apt-get install python-paramiko
Next is the code to implement the remote download.
def remote_scp(host_ip,remote_path,local_path,username,password): t = ((host_ip,22)) (username=username, password=password) # Log in to the remote server sftp = .from_transport(t) # sftp transport protocol src = remote_path des = local_path (src,des) ()
Readers interested in more Python related content can check out this site's topic: theSummary of Python function usage tips》、《Summary of Python string manipulation techniques》、《Python introductory and advanced classic tutorialsand theSummary of Python file and directory manipulation techniques》
I hope that what I have said in this article will help you in Python programming.