久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 ftplib 訪問 FTP URL

Access FTP URL with ftplib(使用 ftplib 訪問 FTP URL)
本文介紹了使用 ftplib 訪問 FTP URL的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 Windows 中使用帶有 ftplib 的 python 來訪問 ftp5.xyz.eu 的文件夾.

I am using python in Windows with ftplib to access a folder at ftp5.xyz.eu.

文件夾是 ftp5.xyz.eu 中的文件夾 'foo bar' 中的 'baz'.所以:ftp5.xyz.eu/foo bar/baz

The folder is 'baz' in ftp5.xyz.eu in the folder 'foo bar'. So : ftp5.xyz.eu/foo bar/baz

我在 ftp5.xyz.eu 成功連接,但是當我將整個路徑寫入文件夾時,它給了我一個錯誤:

I connect successfully at ftp5.xyz.eu but when i write the whole path to the folder it gives me an error:

from ftplib import FTP

#domain name or server ip:
ftp = FTP('ftp5.xyz.eu/foo%20bar')
...
ftp.dir()

錯誤如下:

  File "C:Usersmirel.voicuAppDataLocalProgramsPythonPython37libftplib.py", line 117, in __init__
    self.connect(host)
  File "C:Usersmirel.voicuAppDataLocalProgramsPythonPython37libftplib.py", line 152, in connect
    source_address=self.source_address)
  File "C:Usersmirel.voicuAppDataLocalProgramsPythonPython37libsocket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "C:Usersmirel.voicuAppDataLocalProgramsPythonPython37libsocket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

推薦答案

這個和空間無關.FTP 構造函數的第一個參數 是 host - 主機名IP 地址 - 不是 URL.

This has nothing to do with the space. The first argument of FTP constructor is host – a hostname or an IP address – not an URL.

應該是這樣的:

ftp = FTP('ftp5.xyz.eu')


如果您想列出 foo bar 子文件夾中的文件,請執行以下操作:


If you want to list files in foo bar subfolder, either do:

ftp.cwd('foo bar')      
ftp.dir()

ftp.dir('foo bar')

這篇關于使用 ftplib 訪問 FTP URL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why I cannot make an insert to Python list?(為什么我不能插入 Python 列表?)
Insert a column at the beginning (leftmost end) of a DataFrame(在 DataFrame 的開頭(最左端)插入一列)
Python psycopg2 not inserting into postgresql table(Python psycopg2 沒有插入到 postgresql 表中)
list extend() to index, inserting list elements not only to the end(list extend() 索引,不僅將列表元素插入到末尾)
How to add element in Python to the end of list using list.insert?(如何使用 list.insert 將 Python 中的元素添加到列表末尾?)
TypeError: #39;float#39; object is not subscriptable(TypeError:“浮動對象不可下標)
主站蜘蛛池模板: 成人av免费在线观看 | 看av网| 精品视频成人 | 自拍在线| 天天综合天天 | av在线天天| 午夜www| 看av在线| 国产精品1 | 国产精品久久国产精品久久 | 色婷婷亚洲一区二区三区 | 综合激情久久 | 中国av在线免费观看 | 亚洲精品黄色 | 亚洲交性| 成人高潮片免费视频欧美 | 久久久www成人免费精品 | 午夜手机在线 | 亚洲激情专区 | 精品国产一区二区三区久久久蜜月 | 99热欧美 | www.日本国产 | 九九精品在线 | 国产免费又黄又爽又刺激蜜月al | 成人一区av | 国产精品一区二区在线观看 | 黄色片免费看 | 99精品免费久久久久久日本 | 午夜精品久久久久久久 | 波多野结衣一区二区三区在线观看 | 欧美亚洲综合久久 | 成人国产在线观看 | 国产欧美视频一区二区三区 | 久久久亚洲成人 | 成人av一区二区三区 | 精品日韩在线 | 91精品国产综合久久婷婷香蕉 | 黄一级| 国产精品久久久久久一区二区三区 | 韩日在线观看视频 | 国产精品久久久久久久久图文区 |