久久久久久久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:“浮動對象不可下標)
主站蜘蛛池模板: 成人激情视频在线观看 | 日韩一| 黑人巨大精品 | 亚洲国产精品久久久 | 国产精品美女久久久 | 亚洲成人黄色 | 手机日韩 | 精品一区二区三区在线观看国产 | 精品九九 | 日本精品一区二区在线观看 | 欧美一级毛片在线播放 | 少妇特黄a一区二区三区88av | 成人亚洲在线 | 久久久精品一区二区三区四季av | 美女视频一区二区三区 | 免费视频中文字幕 | 亚洲成人精品影院 | 一区二区三区 在线 | 欧美一级做性受免费大片免费 | 午夜三区 | 91网站在线看 | 国产精品jizz在线观看老狼 | 亚洲成人中文字幕 | 成人不卡 | 国产成人综合在线 | 天天插日日操 | 日本黄色影片在线观看 | 欧美午夜激情在线 | 亚洲午夜视频在线观看 | 精品久久九 | 一区二区精品视频 | 亚洲福利网 | 欧美8一10sex性hd | 最新国产精品 | 亚洲精品99 | 国户精品久久久久久久久久久不卡 | 91久久久久久| 操久久| 久久久久久看片 | 一级黄色短片 | 精品成人一区二区 |