久久久久久久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 構造函數(shù)的第一個參數(shù) 是 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 子文件夾中的文件,請執(zhí)行以下操作:


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模板網(wǎng)!

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

相關文檔推薦

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:“浮動對象不可下標)
主站蜘蛛池模板: 黄色毛片在线观看 | 国产精品美女久久久久久久网站 | 欧美日韩综合精品 | 日韩视频在线免费观看 | 99久久久久久久久 | 欧美视频1区 | 乳色吐息在线观看 | 国产一区二区三区久久久久久久久 | 色爱综合 | 久久三级影院 | 亚洲三区视频 | 精品欧美一区免费观看α√ | 在线观看免费av片 | 亚洲精品一区在线 | 免费观看毛片 | 欧美一级在线免费观看 | 欧产日产国产精品视频 | 国产精品视频播放 | 99国产精品久久久 | 99re视频在线免费观看 | 特一级黄色毛片 | a级免费观看视频 | 国产福利在线免费观看 | 国产成人福利在线观看 | 精品一区二区免费视频 | 国产乱码精品1区2区3区 | 99精品99 | 羞羞羞视频| 国产精品欧美一区二区三区不卡 | 91精品国产91久久久久久 | 成年人网站免费视频 | 久久国产婷婷国产香蕉 | 国产精品视频区 | 免费观看av | 成人av高清在线观看 | 欧美国产免费 | 久草热线 | 亚洲精品久久久久久久久久久久久 | 久久一二区 | av网站在线看 | 日韩高清黄色 |