configparser.ConfigParser.readfp()

readfp(fp, filename=None)

Deprecated since version 3.2: Use read_file() instead.

Changed in version 3.2: readfp() now iterates on f instead of calling f.readline().

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:

def readline_generator(f):
    line = f.readline()
    while line:
        yield line
        line = f.readline()

Instead of parser.readfp(f) use parser.read_file(readline_generator(f)).

doc_python
2016-10-07 17:29:13
Comments
Leave a Comment

Please login to continue.