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

readlines() 在 Python 3 中是否返回列表或迭代器?

Does readlines() return a list or an iterator in Python 3?(readlines() 在 Python 3 中是否返回列表或迭代器?)
本文介紹了readlines() 在 Python 3 中是否返回列表或迭代器?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我讀過深入 Python 3".那:

I've read in "Dive into Python 3" that:

readlines() 方法現在返回一個迭代器,因此它與 Python 2 中的 xreadlines() 一樣高效".em>

"The readlines() method now returns an iterator, so it is just as efficient as xreadlines() was in Python 2".

參見:附錄 A:移植代碼使用 2to3 到 Python 3:A.26 xreadlines() I/O 方法.

我不確定這是不是真的,因為他們在這里沒有提到:http://docs.python.org/release/3.0.1/whatsnew/3.0.html .如何檢查?

I'm not sure that's true because they don't mention it here: http://docs.python.org/release/3.0.1/whatsnew/3.0.html . How can I check that?

推薦答案

像這樣:

Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('/junk/so/foo.txt')
>>> type(f.readlines())
<class 'list'>
>>> help(f.readlines)
Help on built-in function readlines:

readlines(...)
    Return a list of lines from the stream.

    hint can be specified to control the number of lines read: no more
    lines will be read if the total size (in bytes/characters) of all
    lines so far exceeds hint.

>>>

這篇關于readlines() 在 Python 3 中是否返回列表或迭代器?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 日批免费看 | 一级在线毛片 | 99亚洲精品 | 成人亚洲 | 日韩中文字幕一区 | 丝袜久久 | 国产xxxx搡xxxxx搡麻豆 | 久久精品视频亚洲 | 国内精品久久久久久久 | 日韩精品免费在线 | 91高清在线观看 | 精品国产一区探花在线观看 | 成人精品视频免费 | 人人做人人澡人人爽欧美 | 久久在视频 | www.一级毛片 | 91精品一区二区三区久久久久久 | 欧美国产日韩精品 | 午夜免费精品视频 | av在线一区二区 | 亚洲高清在线视频 | 伊人影院在线观看 | 久久大陆| 国产一区二区三区精品久久久 | 99国产精品99久久久久久 | 精品国产青草久久久久福利 | 国产在线一区二区 | 爱爱免费视频 | 这里只有精品99re | 久久国产精品免费视频 | a级在线 | 国产欧美在线播放 | 黄色毛片在线观看 | 天天看天天摸天天操 | 国产xxxx搡xxxxx搡麻豆 | 久久99深爱久久99精品 | 成人影院免费视频 | 久久亚洲视频 | 国产高清在线精品一区二区三区 | 欧美性受xxxx白人性爽 | 国产精品久久久久久久久久久久冷 |