ID EN
Config Parser

readfp

Python 3.11 🇮🇩 Bahasa Indonesia

For existing code calling readfp() with arguments which don’t support iteration, the following generator may be used as a wrapper around the file-like object:

Syntax

PYTHON
readfp(fp, filename=None)

Contoh

Example 1
PYTHON
def readline_generator(fp):
    line = fp.readline()
    while line:
        yield line
        line = fp.readline()

See Also

read_file() readfp() readfp()