回覆列表
  • 1 # 使用者5778403700690

    用Python指令碼編寫一個登入的測試指令碼#!/usr/bin/python#-*- coding: UTF-8 -*-from ftplib import FTPfrom ftplib import all_errorsfrom urlparse import urlparseimport os,sys,string,datetime,time,globimport socketclass uploadresource: def __init__(self): self.ftpurl = urlparse("ftp://username:passwd@hostname") self.ftp = FTP() def login(self): try: socket.setdefaulttimeout(10) self.ftp.set_pasv(False) self.ftp.connect(self.ftpurl.hostname, 21) self.ftp.login(self.ftpurl.username, self.ftpurl.password) print "FTP登入成功" except all_errors as e : print "FTP登入失敗:", str(e)if __name__ == "__main__": f = uploadresource() f.login()

  • 中秋節和大豐收的關聯?
  • 形容女子長相清秀的成語?