Readline and readlines methods missing in python 3.2?

Did they remove file.readline () and file.readlines () from python 3.2? If so, what did they replace?

+3
source share
4 answers

While there is no type filein Python 3.x, different types of module io, which replaces the old filetype maintain f.readline()andf.readlines() . You really do not need these methods, since they can be replaced by next(f)and list(f).

+4
source

Here is the documentation (well, tutorial) for Python 3.2. readlineand readlinesare still part of Python.

+2
source

, .

f = open("file", "r")
f.readlines()

, Python 3.2.

EDIT: io ( ).

+1

. ,

import readline

script, . , .

0

All Articles