久久久久久久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:“浮動對象不可下標)
主站蜘蛛池模板: 日韩高清国产一区在线 | 国产成人午夜电影网 | 成人妇女免费播放久久久 | 久久网站免费视频 | 九一国产精品 | 欧美成人猛片aaaaaaa | 91免费视频观看 | 国产欧美日韩综合精品一区二区 | 成人亚洲性情网站www在线观看 | 国产91一区 | 91中文字幕在线 | 久久久精品 | 久久久久国产一区二区三区 | 欧美日韩成人在线 | 成人久久18免费网站图片 | 国产色| 色久电影 | 男女羞羞视频网站 | 大乳boobs巨大吃奶挤奶 | 日本亚洲欧美 | 日韩一区二区三区在线 | 精品日韩| 日韩中文字幕在线 | 久久国产精品视频 | 亚洲精品在线视频 | 国产成人亚洲精品自产在线 | 久久精品av麻豆的观看方式 | 亚洲综合区 | 亚洲综合在线网 | av激情在线 | 国产美女在线观看 | 激情欧美一区二区三区中文字幕 | 成人一区在线观看 | 成人福利 | 国产精品毛片 | 亚洲欧美视频 | 欧美三区在线观看 | 成人免费在线网 | 欧美国产日韩一区二区三区 | 亚洲精品一区二区三区中文字幕 | 国产精品久久久久久福利一牛影视 |