Skip to content

Error in read the docs? #180

@lachlansimpson

Description

@lachlansimpson

On the Usage page of read the docs you have this snippet under the section for multiple files

for filename in glob.glob('*.xml'):
    print filename.ljust(60),
    detector.reset()
    for line in file(filename, 'rb'):
        detector.feed(line)
        if detector.done: break
    detector.close()
    print detector.result

When using with Python 3.7 I had to change the for loop on line 4 to use open instead of file:

for filename in glob.glob('*.xml'):
    print(filename.ljust(60),)
    detector.reset()
    for line in open(filename, 'rb'):
        detector.feed(line)
        if detector.done: break
    detector.close()
    print(detector.result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions