久久久久久久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 | 欧美精品99久久久 | www.日本黄色 | 午夜黄色影院 | 欧美在线播放视频 | 天天插天天 | 欧美日韩免费看 | 免费黄色一级视频 | 成人三级在线 | 三上悠亚一区 | 国产精品一区二区久久 | 久久午夜精品 | 色偷偷网站 | 一级片av | 日本www色| 欧美123区 | 自拍偷拍福利视频 | 欧美精产国品一二三区 | 毛片视频免费 | 亚洲精品1区 | 久久免费国产视频 | 欧美一级久久 | www一级片| 久久久夜色精品 | 欧美色图一区二区 | 国产成人一区二区三区 | 亚洲h视频 | 国产精品久久久久久久久久辛辛 | 亚洲一区二区免费视频 | 成人av一区二区三区在线观看 | 九九热这里只有 | 成人国产精品免费观看 | 欧美日韩激情视频 | 亚洲精品少妇 | 日韩精品一区二区在线 | 国产裸体永久免费视频网站 | 男男av| 国产成人免费视频 | 香蕉成人| 一级片免费在线观看 |