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

在 Python 中從 retrlines 創建列表

Creating list from retrlines in Python(在 Python 中從 retrlines 創建列表)
本文介紹了在 Python 中從 retrlines 創建列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

您將如何在 FTP 目錄中創建條目列表?

How exactly would you create a list of the entries in an FTP directory?

這是我目前的代碼:

import ftplib

files = []

my_ftp = ftplib.FTP(HOST)
my_ftp.login(USERNAME,PASSWORD)

line = my_ftp.retrlines("NLST",files.append(line))
my_ftp.quit()

錯誤表示變量 line 在定義之前就被使用了.

The error says that the variable line is being used before it is defined.

推薦答案

你可能只想使用 nlst:

>>> my_ftp.nlst()
['pub', 'etc', 'ports']

這篇關于在 Python 中從 retrlines 創建列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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:“浮動對象不可下標)
主站蜘蛛池模板: 国产精品久久久久永久免费看 | 色综合天天综合网天天狠天天 | 四虎看片| 久久久网 | 国产无遮挡又黄又爽又色 | 色综合久久综合 | 亚洲第一区视频 | 亚洲精品欧美 | 中文字幕一区二区三区视频 | 黑人精品xxx一区一二区 | 久久99久久久 | 97人人看| 男人添女荫道口图片 | 久久久亚洲精品视频 | 色妞网| 国产二区三区 | 久艹在线| 日韩综合在线观看 | 成人网页| 久久久精品一区 | 毛片av在线| 五月色丁香 | 日韩一级免费 | 九色视频丨porny丨丝袜 | 91精品91久久久中77777 | 国产精品三| 日韩一区二区三区在线播放 | 日本特黄一级片 | 久草网在线| 中文字幕在线观看日韩 | 久久精品小视频 | 在线看片a | 中文字幕99| 国产区在线 | 在线观看欧美日韩 | 久久精品www人人爽人人 | 黄色免费网站在线观看 | 国产在线视频91 | 久久视频一区 | 色av综合| 亚洲最大黄色网址 |