Python脚本通过FTP上传文件

我想编写一个脚本将文件上传到FTP。


登录系统将如何工作?我正在寻找这样的东西:


ftp.login=(mylogin)

ftp.pass=(mypass)

以及任何其他登录凭据。


python 图像 上传 ftp 截图


翻过高山走不出你
浏览 575回答 3
3回答

慕田峪9158850

尝试这个:#!/usr/bin/env pythonimport osimport paramiko ssh = paramiko.SSHClient()ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())ssh.connect('hostname', username="username", password="password")sftp = ssh.open_sftp()localpath = '/home/e100075/python/ss.txt'remotepath = '/home/developers/screenshots/ss.txt'sftp.put(localpath, remotepath)sftp.close()ssh.close()
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python